From 6602e1cf2dccbd0cbdcdf3e5e4547dbc6f0c5b6d Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 23 Aug 2019 08:40:16 +0000 Subject: [FIX] web: grouped list with node and onchange MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's assume an editable grouped list view with a node containing subfields, and an onchange. Edit a row to trigger the onchange. Before this rev., it crashed because the onchange specs was incorrect: it followed the relation of the many2one and thus included its subfields (whereas it should only follow the relation for x2many fields). For example, go to Accounting > Accounting > Sales and edit the label of a move line. Task 2044187 closes odoo/odoo#36001 Signed-off-by: Géry Debongnie (ged) --- addons/web/static/src/js/views/basic/basic_model.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/views/basic') 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 3bd11a9722a..eca8388aaa4 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -2001,9 +2001,11 @@ var BasicModel = AbstractModel.extend({ if (field.onChange) { hasOnchange = true; } - _.each(fieldInfo.views, function (view) { - generateSpecs(view.fieldsInfo[view.type], view.fields, key + '.'); - }); + if (field.type === 'one2many' || field.type === 'many2many') { + _.each(fieldInfo.views, function (view) { + generateSpecs(view.fieldsInfo[view.type], view.fields, key + '.'); + }); + } }); } return hasOnchange ? specs : false; -- cgit v1.2.3