summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-05-29 15:14:49 +0200
committerAaron Bohy <aab@odoo.com>2017-05-29 20:53:40 +0200
commit27463eadabb40747c53c51817cf853fdd91d192f (patch)
tree85c6d03cd8bc74e8884a90252f897281e4584d33 /addons/web/static/src/js/views/basic/basic_model.js
parent45bce324f34eeb8ee69e028e0d20b08d998c0eef (diff)
[FIX] web: FieldMany2Many: don't save if nothing changed
Suppose that there is a many2many list (non editable) in a form view. When one of the many2many subrecords is edited (from the form view in a dialog), it is saved directly when the user clicks on 'Save' in the dialog. Before this rev., if the user clicked on 'Save' in the main form view after editing a m2m subrecord, a 'write' RPC was done, whereas there were nothing left to save (as the subrecord had already been saved).
Diffstat (limited to 'addons/web/static/src/js/views/basic/basic_model.js')
-rw-r--r--addons/web/static/src/js/views/basic/basic_model.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js
index 11961e6fecf..595c39103d3 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -1117,6 +1117,14 @@ var BasicModel = AbstractModel.extend({
* @returns {Deferred}
*/
_applyX2ManyChange: function (record, fieldName, command, viewType) {
+ if (command.operation === 'TRIGGER_ONCHANGE') {
+ // the purpose of this operation is to trigger an onchange RPC, so
+ // there is no need to apply any change on the record (the changes
+ // have probably been already applied and saved, usecase: many2many
+ // edition in a dialog)
+ return $.when();
+ }
+
var self = this;
var list = this.localData[record._changes[fieldName] || record.data[fieldName]];
var field = record.fields[fieldName];