From 1400b0b9f46a86254c166b422a0b23ed3b3c7a24 Mon Sep 17 00:00:00 2001 From: "Simon Genin (ges)" Date: Wed, 16 Sep 2020 13:13:39 +0000 Subject: [FIX] web: reference field calls name_create An older commit (50bf8309) had refactor part of the basic field _applyX2ManyOperations. During this refactor, the reference field was forgotten to be included in a condition that made the field no longer do the quick create behavior. The name_create function in the backend was no longer called. Adds a test for the reference field checking the call to the name_create function and fixes the problem. Task id 2322048 closes odoo/odoo#59013 X-original-commit: e7d4baa3d52dc73c9631365801fbe41a4d54e3a1 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/src/js/views/basic/basic_model.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/views/basic/basic_model.js') 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 bb599b2e859..3b750fc743a 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -1583,7 +1583,8 @@ var BasicModel = AbstractModel.extend({ const field = record.fields[fieldName]; const coModel = field.type === 'reference' ? data.model : field.relation; - if (field.type === 'many2one' && !data.id && data.display_name) { + const allowedTypes = ['many2one', 'reference']; + if (allowedTypes.includes(field.type) && !data.id && data.display_name) { // only display_name given -> do a name_create const result = await this._rpc({ model: coModel, -- cgit v1.2.3