diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-08-24 14:36:53 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-08-25 15:54:56 +0200 |
| commit | 8019eacb4716befcc0affa4f8c9d554be2ec6655 (patch) | |
| tree | 4b81593d9f835e1e84295443a1e07687fca9a900 /addons/barcodes/static/src | |
| parent | 5f40f21adcbbd47409831a32e19777387a740c12 (diff) | |
[FIX] barcodes: generate correct update command
The barcode mechanism is optimized to (in certain conditions),
directly increment the quantity of a numerical field inside an
x2many, without performing any RPC, and then re-rendering the
x2many to display the new value.
Before this rev., it seemed to work fine, but when the view was
saved, those changes of quantity were lost. This was because the
changes weren't correctly notified to the model (the quantity
field being inside an x2many, the correct update command for the
x2many should be generated).
Diffstat (limited to 'addons/barcodes/static/src')
| -rw-r--r-- | addons/barcodes/static/src/js/barcode_form_view.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/addons/barcodes/static/src/js/barcode_form_view.js b/addons/barcodes/static/src/js/barcode_form_view.js index c238df4da59..8f6a3b0a3e2 100644 --- a/addons/barcodes/static/src/js/barcode_form_view.js +++ b/addons/barcodes/static/src/js/barcode_form_view.js @@ -93,8 +93,14 @@ FormController.include({ */ _barcodeSelectedCandidate: function (candidate, record, barcode, activeBarcode) { var changes = {}; - changes[activeBarcode.quantity] = candidate.data[activeBarcode.quantity] + 1; - return this.model.notifyChanges(candidate.id, changes); + var candidateChanges = {}; + candidateChanges[activeBarcode.quantity] = candidate.data[activeBarcode.quantity] + 1; + changes[activeBarcode.fieldName] = { + operation: 'UPDATE', + id: candidate.id, + data: candidateChanges, + }; + return this.model.notifyChanges(this.handle, changes); }, /** * @private |
