summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic/basic_model.js
diff options
context:
space:
mode:
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.js6
1 files changed, 3 insertions, 3 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 1562bffdc42..2baafc52514 100644
--- a/addons/web/static/src/js/views/basic/basic_model.js
+++ b/addons/web/static/src/js/views/basic/basic_model.js
@@ -95,11 +95,13 @@ var x2ManyCommands = {
// (0, _, {values})
CREATE: 0,
create: function (values) {
+ delete values.id;
return [x2ManyCommands.CREATE, false, values];
},
// (1, id, {values})
UPDATE: 1,
update: function (id, values) {
+ delete values.id;
return [x2ManyCommands.UPDATE, id, values];
},
// (2, id[, _])
@@ -2625,7 +2627,6 @@ 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);
}
@@ -2645,7 +2646,6 @@ var BasicModel = AbstractModel.extend({
relRecord = _.findWhere(relRecordUpdated, {res_id: list.res_ids[i]});
changes = relRecord ? this._generateChanges(relRecord, options) : {};
if (!_.isEmpty(changes)) {
- delete changes.id;
command = x2ManyCommands.update(relRecord.res_id, changes);
didChange = true;
} else {
@@ -2656,7 +2656,7 @@ var BasicModel = AbstractModel.extend({
// this is a new id (maybe existing in DB, but new in JS)
relRecord = _.findWhere(relRecordAdded, {res_id: list.res_ids[i]});
changes = this._generateChanges(relRecord, options);
- if ('id' in changes) {
+ if (changes.id) {
// the subrecord already exists in db
delete changes.id;
if (this.isNew(record.id)) {