Skip to content
Snippets Groups Projects
Commit 4212f84d authored by Nicolas Lempereur's avatar Nicolas Lempereur Committed by Aaron Bohy
Browse files

[FIX] web: nested x2many with no widget and onchanges


Let's assume the following situation: in a form view, there is a
one2many field A displayed as a list (non editable). In the list,
there is another one2many field B displayed with no widget (it
basically displays "X records"). In A's form view, B is also
displayed, but this time as a list.

There is an onchange on the main form view that adds a line in A,
(and simply sets B to [[5]], i.e. 'No record').

Before this commit, if the user opened the newly added sub record in
A, and clicked on 'Add a line' of B, it crashed.

The cause of the crash was that the wrong viewType was used to
create the new (default) record in B: it used the original
viewType, which was undefined (B is displayed with no widget in
A's list). With this commit, we use the viewType of B that is used
to edit it, in this case 'list'.

In the slighlty different scenario where B is displayed with
widget many2many_tags in A's list, there were no crash, but wrong
fieldNames were sent to the 'default_get' RPC. As a consequence,
default values for fields in B's list were potentially not loaded.

opw-2422806
closes #64793

closes odoo/odoo#65157

Signed-off-by: default avatarGéry Debongnie (ged) <ged@openerp.com>
Signed-off-by: default avatarAaron Bohy (aab) <aab@odoo.com>
Co-authored-by: default avatarAaron Bohy <aab@odoo.com>
parent 1622aa75
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment