summaryrefslogtreecommitdiff
path: root/addons/barcodes/static/src/js
diff options
context:
space:
mode:
authorArnold Moyaux <arm@odoo.com>2018-02-22 11:43:00 +0100
committerArnold Moyaux <arm@odoo.com>2018-03-07 14:55:31 +0100
commit98547bf0cdb71401842ad6aa7777535bdc96e980 (patch)
tree34872f3cea5b205c0bdf46868933a8e87d4be397 /addons/barcodes/static/src/js
parentcf3ed5e547653078e0e991dd6348a5e65dc9bb43 (diff)
[FIX] barcodes: Do not trigger useless onchange server side.
This commit improve perf by not trigger onchange server side on one2many field if the js could find a candidate. opw-785425
Diffstat (limited to 'addons/barcodes/static/src/js')
-rw-r--r--addons/barcodes/static/src/js/barcode_form_view.js5
1 files changed, 4 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 aa66016e8ba..1730b42290e 100644
--- a/addons/barcodes/static/src/js/barcode_form_view.js
+++ b/addons/barcodes/static/src/js/barcode_form_view.js
@@ -155,7 +155,7 @@ FormController.include({
id: candidate.id,
data: candidateChanges,
};
- return this.model.notifyChanges(this.handle, changes);
+ return this.model.notifyChanges(this.handle, changes, {notifyChange: activeBarcode.notifyChange});
},
/**
* @private
@@ -211,6 +211,8 @@ FormController.include({
* @param {OdooEvent} event
* @param {string} event.data.name: the current field name
* @param {string} [event.data.fieldName] optional for x2many sub field
+ * @param {boolean} [event.data.notifyChange] optional for x2many sub field
+ * do not trigger on change server side if a candidate has been found
* @param {string} [event.data.quantity] optional field to increase quantity
* @param {Object} [event.data.commands] optional added methods
* can use comand with specific barcode (with ReservedBarcodePrefixes)
@@ -227,6 +229,7 @@ FormController.include({
widget: event.target.attrs && event.target.attrs.widget,
setQuantityWithKeypress: !! event.data.setQuantityWithKeypress,
fieldName: event.data.fieldName,
+ notifyChange: (event.data.notifyChange !== undefined) ? event.data.notifyChange : true,
quantity: event.data.quantity,
commands: event.data.commands || {},
candidate: this.activeBarcode[name] && this.activeBarcode[name].handle === this.handle ?