[IMP] web: make addNew return the newly created record

used in product configurator logic

X-original-commit: 40cfbf35985422a9415e6ab225d037f7393d3842
Part-of: odoo/odoo#101352
Co-authored-by: Samuel Degueldre <sad@odoo.com>
This commit is contained in:
Victor Feyens
2022-09-28 11:14:34 +02:00
co-authored by Samuel Degueldre
parent 6d834e2b9e
commit 80b19b11d6
@@ -977,10 +977,11 @@ export class StaticList extends DataPoint {
await this.model.__bm__.save(this.__bm_handle__, { savePoint: true });
this.model.__bm__.freezeOrder(this.__bm_handle__);
await this.__syncParent(operation);
const newRecord = this.records[position === "bottom" ? this.records.length - 1 : 0];
if (params.mode === "edit") {
const newRecord = this.records[position === "bottom" ? this.records.length - 1 : 0];
await newRecord.switchMode("edit");
}
return newRecord;
}
// x2many dialog edition