diff options
| author | Aaron Bohy <aab@odoo.com> | 2019-11-07 07:51:51 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-03-09 14:14:39 +0000 |
| commit | a9cebd5acbba40ae63aa9f986d9bab39b2112f92 (patch) | |
| tree | 9e12efe671c7110e6d060919bf024ba3a30ac302 /addons/web/static/src/js/fields | |
| parent | f129dff5a0094b07bba2f8886513cded0a2d21c6 (diff) | |
[FIX] web: handle nested one2manys and onchange
Let's assume the following scenario in a form view:
- have a one2many field, say fieldA, displayed as a list,
containing another one2many, fieldB, (no widget, thus
displaying 'n record(s)')
- the one2many list is not editable, so there is a sub form view,
displaying fieldB as a list, and in this list some random field,
say fieldC, is displayed
- have a random field on the main form view, with an onchange to
populate the one2many
- set that random field s.t. the onchange returns something like
fieldA: [[5], [0, 0, {fieldB: [[0, 0, {fieldC: 'value'}]]}]]
- there is now a record in fieldA's list, displaying '1 record'
as value for fieldB
- click on that record to open it in a form view (dialog)
- in the dialog, in fieldB's list, we expect to have a single row
displaying 'value' as value for fieldC
Before this rev., it crashed when opening the record in the dialog,
whether the form view was inline or not.
The crash occured because fieldB was already in the list view, so
datapoints already existed for it (a list datapoint, and record
datapoints for records in the relation, in our example one record
datapoint). However, those datapoints didn't have the fieldsInfo of
the form view. When opening the form view, we added the fieldsInfo
of the form to the datapoint of the record we opened, but we didn't
recursively apply the fieldsInfo to its children. As a consequence,
when rendering the list view for fieldB in the dialog, we haven't
the information about fieldC, and it crashed.
Note that if fieldB wasn't present in fieldA's list view, it worked
fine because datapoints didn't exist before we opened the record in
the dialog.
Task 2120235
Diffstat (limited to 'addons/web/static/src/js/fields')
0 files changed, 0 insertions, 0 deletions
