diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-07-05 13:17:59 +0200 |
|---|---|---|
| committer | Quentin Smetz (qsm) <qsm@odoo.com> | 2018-07-09 11:59:30 +0200 |
| commit | 2c966909e2c0b5e45912a6ff85577f0b19a5f4c9 (patch) | |
| tree | 71d294f0a0577c13561bf079aa58fd2395653f11 /addons/barcodes | |
| parent | 49a905321a5b94df6d87355c57c4c1a02d349502 (diff) | |
[FIX] *: fix some side-effects of https://github.com/odoo/odoo/commit/9de1bc0eef6f5bfaa2a8d745431caa361ae91548
- JS Modals were not correctly built anymore, their .modal-body element
was duplicated and many without-effect JS lines were introduced (as a
side effect, the form view design was broken when inside modals)
- Tests were changed to make bugs go unnoticed. For example, the media
dialog functionnality was entirely broken because the .modal-dialog
element was not receiving the correct class anymore.
- The JS translation function is _t, not _
- Do not use the <title/> tag as a regular DOM element, it is meant to
be unique, in the <head/> section
- CSS rules were added to the utils.scss file, which is meant to contain
functions and mixins, otherwise, the rule is duplicated in every asset
- Some icons were still broken, as missed by https://github.com/odoo/odoo/commit/f90cf060a3cfeb37a67bec83264c0aaab8892b56
- Tests were changed to use [role="dialog"]/footer/header in their
selectors without any reason, this commit restores some of that to
avoid rebase conflicts with the BS4 work.
- ...
Note: other elements should still be discussed, like the direct use of
the 'o_form_label' class in views definition... but those do not cause
direct problems.
Diffstat (limited to 'addons/barcodes')
| -rw-r--r-- | addons/barcodes/static/src/js/barcode_form_view.js | 2 | ||||
| -rw-r--r-- | addons/barcodes/static/tests/barcode_tests.js | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/addons/barcodes/static/src/js/barcode_form_view.js b/addons/barcodes/static/src/js/barcode_form_view.js index 9a09480558b..15e27498f94 100644 --- a/addons/barcodes/static/src/js/barcode_form_view.js +++ b/addons/barcodes/static/src/js/barcode_form_view.js @@ -349,7 +349,7 @@ FormController.include({ } // only catch the event if we're not focused in // another field and it's a number - if (!$(event.target).is('body, [role="dialog"]') || !/[0-9]/.test(character)) { + if (!$(event.target).is('body, .modal') || !/[0-9]/.test(character)) { return; } diff --git a/addons/barcodes/static/tests/barcode_tests.js b/addons/barcodes/static/tests/barcode_tests.js index e6efcbe35a0..142fc0feca3 100644 --- a/addons/barcodes/static/tests/barcode_tests.js +++ b/addons/barcodes/static/tests/barcode_tests.js @@ -468,12 +468,12 @@ QUnit.test('specification of widget barcode_handler with keypress and notifyChan setTimeout(function () { var keycode = $.ui.keyCode.ENTER; - assert.strictEqual($('main.modal-body').length, 1, 'should open a modal with a quantity as input'); - assert.strictEqual($('main.modal-body .o_set_qty_input').val(), '5', 'the quantity by default in the modal shoud be 5'); + assert.strictEqual($('.modal .modal-body').length, 1, 'should open a modal with a quantity as input'); + assert.strictEqual($('.modal .modal-body .o_set_qty_input').val(), '5', 'the quantity by default in the modal shoud be 5'); - $('main.modal-body .o_set_qty_input').val('7'); + $('.modal .modal-body .o_set_qty_input').val('7'); - $('main.modal-body .o_set_qty_input').trigger($.Event('keypress', {which: keycode, keyCode: keycode})); + $('.modal .modal-body .o_set_qty_input').trigger($.Event('keypress', {which: keycode, keyCode: keycode})); assert.strictEqual(form.$('.o_data_row .o_data_cell:nth(1)').text(), '7', "quantity checked should be 7"); @@ -524,7 +524,7 @@ QUnit.test('barcode_scanned only trigger error for active view', function (asser form.$('.o_data_row:first').click(); - // We do not trigger on the body since modal and + // We do not trigger on the body since modal and // form view are both inside it. function modalTriggerKeypressEvent(char) { var keycode; @@ -533,7 +533,7 @@ QUnit.test('barcode_scanned only trigger error for active view', function (asser } else { keycode = char.charCodeAt(0); } - return $('[role="dialog"]').trigger($.Event('keypress', {which: keycode, keyCode: keycode})); + return $('.modal').trigger($.Event('keypress', {which: keycode, keyCode: keycode})); } _.each(['O','-','B','T','N','.','c','a','n','c','e','l','Enter'], modalTriggerKeypressEvent); assert.verifySteps(['warning'], "only one event should be triggered"); |
