summaryrefslogtreecommitdiff
path: root/addons/barcodes/static/src
diff options
context:
space:
mode:
authorArnold Moyaux <arm@odoo.com>2018-02-22 15:38:27 +0100
committerArnold Moyaux <arm@odoo.com>2018-03-07 13:20:52 +0100
commitf95566f08ae726402e7f1de70c1f5c042337c180 (patch)
treee8bae48def04a390ea8be353d598d766400de9b8 /addons/barcodes/static/src
parentcf5142e05972cbf81d0af5b62e5a637c9eeabe9a (diff)
[FIX] barcode: set quantity with key press
Allow the user to set the quantity with barcode scanning. This functionality was present in v9 but didn't work in v11. The code in order to make it work was already present in _quantityListener however it makes a check on setQuantityWithKeypress key on the obejct activeBarcode. Howver the key was never set during the activeBarcode event. This commit set the key on the activeBarcode if passed in the event data. It also allow to trigger a barcode if the user is inside a modal.
Diffstat (limited to 'addons/barcodes/static/src')
-rw-r--r--addons/barcodes/static/src/js/barcode_form_view.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/barcodes/static/src/js/barcode_form_view.js b/addons/barcodes/static/src/js/barcode_form_view.js
index fa5b27e2a9c..aa66016e8ba 100644
--- a/addons/barcodes/static/src/js/barcode_form_view.js
+++ b/addons/barcodes/static/src/js/barcode_form_view.js
@@ -225,6 +225,7 @@ FormController.include({
handle: this.handle,
target: event.target,
widget: event.target.attrs && event.target.attrs.widget,
+ setQuantityWithKeypress: !! event.data.setQuantityWithKeypress,
fieldName: event.data.fieldName,
quantity: event.data.quantity,
commands: event.data.commands || {},
@@ -319,7 +320,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') || !/[0-9]/.test(character)) {
+ if (!$(event.target).is('body, .modal') || !/[0-9]/.test(character)) {
return;
}