From 80b19b11d605317b8f2267a820632589eb6e18b4 Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Tue, 27 Sep 2022 17:00:21 +0000 Subject: [PATCH] [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 --- addons/web/static/src/views/basic_relational_model.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/views/basic_relational_model.js b/addons/web/static/src/views/basic_relational_model.js index 7353c2b4e5f..7860b66e1cc 100644 --- a/addons/web/static/src/views/basic_relational_model.js +++ b/addons/web/static/src/views/basic_relational_model.js @@ -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