diff options
| author | Simon Genin (ges) <ges@odoo.com> | 2020-09-16 13:13:39 +0000 |
|---|---|---|
| committer | Simon Genin (ges) <ges@odoo.com> | 2020-10-02 15:48:42 +0000 |
| commit | 1400b0b9f46a86254c166b422a0b23ed3b3c7a24 (patch) | |
| tree | 6421fdd88202daaaea9bcd7132389f174e94562e /addons/web/static/src/js/views/basic/basic_model.js | |
| parent | 44c48501a120b3e8e96dcc82bab701b071650494 (diff) | |
[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) <aab@odoo.com>
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.js | 3 |
1 files changed, 2 insertions, 1 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 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, |
