summaryrefslogtreecommitdiff
path: root/addons/barcodes/static/tests
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-08-24 14:37:13 +0200
committerAaron Bohy <aab@odoo.com>2017-08-25 15:54:56 +0200
commitc73233d2489e3d074d4d13d1c782a97734e29e32 (patch)
tree80e05efac56b44067a77b4e757ba54c334a0464e /addons/barcodes/static/tests
parentdec1bdb44d2ee2bf1874f0a5051bdd7720cbb4d7 (diff)
[FIX] barcodes: don't warn if action unavailable
Before this rev. a warning was displayed when a barcode mapping an invisible button was scanned. It shouldn't, for the following reason. In the stock.picking form view, two buttons with barcode_trigger='validate' are in the page ('Start Inventory' and 'Validate'), and there is always at least one of them that is invisible. So when scanning the 'validate' barcode, we don't want a warning to be displayed, as there is potentially another button that is able to handle the request.
Diffstat (limited to 'addons/barcodes/static/tests')
-rw-r--r--addons/barcodes/static/tests/barcode_tests.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/addons/barcodes/static/tests/barcode_tests.js b/addons/barcodes/static/tests/barcode_tests.js
index ac9ff367d45..e6c87cdaaad 100644
--- a/addons/barcodes/static/tests/barcode_tests.js
+++ b/addons/barcodes/static/tests/barcode_tests.js
@@ -28,7 +28,7 @@ QUnit.module('Barcodes', {
});
QUnit.test('Button with barcode_trigger', function (assert) {
- assert.expect(1);
+ assert.expect(2);
var form = createView({
View: FormView,
@@ -37,6 +37,7 @@ QUnit.test('Button with barcode_trigger', function (assert) {
arch: '<form>' +
'<header>' +
'<button name="do_something" string="Validate" type="object" barcode_trigger="doit"/>' +
+ '<button name="do_something_else" string="Validate" type="object" invisible="1" barcode_trigger="dothat"/>' +
'</header>' +
'</form>',
res_id: 2,
@@ -45,11 +46,18 @@ QUnit.test('Button with barcode_trigger', function (assert) {
assert.strictEqual(event.data.action_data.name, 'do_something',
"do_something method call verified");
},
+ warning: function () {
+ assert.step('warn');
+ },
},
});
// O-BTN.doit
_.each(['O','-','B','T','N','.','d','o','i','t','Enter'], triggerKeypressEvent);
+ // O-BTN.dothat (should not call execute_action as the button isn't visible)
+ _.each(['O','-','B','T','N','.','d','o','t','h','a','t','Enter'], triggerKeypressEvent);
+
+ assert.verifySteps([], "no warning should be displayed");
form.destroy();
});