diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-10-19 10:08:38 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-10-19 10:56:49 +0200 |
| commit | d8f03e64fd46f45446c69f6b851813c559d0d5c7 (patch) | |
| tree | c6c2f52aa563853281f74f9971d4a72468566eb6 /addons/web/static/src/js/views/basic/basic_model.js | |
| parent | 841f41f95b7cf7d8f13ddce724d60d1d1149886d (diff) | |
[FIX] web: do not send id in update commands for m2m
When we generate commands for many2many, it could happen that the id was
in the list of changed fields (when we are in a new records, with a non
empty initial onchange). When this happens, the server is not happy.
To reproduce this, open the uninstall wizard of a module in the 'App'
application. This creates a new record with a non-empty many2many
field. Then click on 'Show technical modules', this will trigger an
onchange which should not send the id field.
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.js | 4 |
1 files changed, 2 insertions, 2 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 8798e8cdb2e..3591ac3cf94 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2595,6 +2595,7 @@ var BasicModel = AbstractModel.extend({ _.each(relRecordUpdated, function (relRecord) { var changes = self._generateChanges(relRecord, options); if (!_.isEmpty(changes)) { + delete changes.id; var command = x2ManyCommands.update(relRecord.res_id, changes); commands[fieldName].push(command); } @@ -2626,9 +2627,8 @@ var BasicModel = AbstractModel.extend({ relRecord = _.findWhere(relRecordAdded, {res_id: list.res_ids[i]}); changes = this._generateChanges(relRecord, options); if ('id' in changes) { - var id = changes.id; delete changes.id; - commands[fieldName].push(x2ManyCommands.update(id, changes)); + commands[fieldName].push(x2ManyCommands.update(relRecord.res_id, changes)); } else { commands[fieldName].push(x2ManyCommands.create(changes)); } |
