diff --git a/addons/web/static/src/views/kanban/kanban_model.js b/addons/web/static/src/views/kanban/kanban_model.js index 04b66194396..898a5f6b829 100644 --- a/addons/web/static/src/views/kanban/kanban_model.js +++ b/addons/web/static/src/views/kanban/kanban_model.js @@ -283,16 +283,24 @@ class KanbanGroup extends Group { */ async validateQuickCreate() { const record = this.list.quickCreateRecord; + let saved = false; if (record) { - const saved = await record.save(); - if (saved) { - this.addRecord(this.removeRecord(record), 0); - this.count++; - this.list.count++; - return record; - } + saved = await this.model.mutex.exec(async () => { + const saved = await record._save({ noReload: true, stayInEdition: true }); + if (saved) { + this.count++; + if (record.parentActiveFields) { + record.setActiveFields(record.parentActiveFields); + record.parentActiveFields = false; + } + await this.model.reloadRecords(record); + record.switchMode("readonly"); + this.addRecord(this.removeRecord(record), 0); + } + return saved; + }); } - return false; + return saved ? record : false; } // ------------------------------------------------------------------------ diff --git a/addons/web/static/src/views/relational_model.js b/addons/web/static/src/views/relational_model.js index ced3ecfaa05..d662ef87f0e 100644 --- a/addons/web/static/src/views/relational_model.js +++ b/addons/web/static/src/views/relational_model.js @@ -1412,6 +1412,7 @@ export class Record extends DataPoint { delete this.virtualId; this.data.id = this.resId; this.resIds.push(this.resId); + this._changes = {}; this.invalidateCache(); } else if (keys.length > 0) { try { @@ -1422,14 +1423,10 @@ export class Record extends DataPoint { } throw e; } + this._changes = {}; this.invalidateCache(); } - // Switch to the parent active fields - if (this.parentActiveFields) { - this.setActiveFields(this.parentActiveFields); - this.parentActiveFields = false; - } this.isInQuickCreation = false; if (shouldReload) { await this.model.reloadRecords(this);