-
- Downloads
[FIX] core: saving of o2m value init'd via onchange
In the SSF, o2m updates get initialized with no values (1, id,
{}). The record data is only fetched when the "record" gets updated
explicitly from which updates will hopefully get properly tracked &
saved.
However if the "record" was first initialized through an onchange
values which are updated by the onchange (diverging from the db) those
would not get tracked and thus wouldn't get saved when the record is
saved.
* use more specific placeholder (None) for "o2m records to update but
we don't have values yet"
* once we have values, always store them as an update-tracking dict
* if we don't have values yet for an o2m and an onchange is trying to
write to it, initialize with values from database first (might
eventually be a good idea to initialize upfront though there's the
question of what happens for default values and recursive views)
* mark anything coming back from the onchange and differing from local
values as changed (so they get sent out on save)
* properly reify parent values for onchange instead of sending them
as-is
* the evaluation context for contexts (and domains) needs properly
formatted values so use `_values_to_save` to get them, however it
cares about neither required-ing nor filtering out e.g. unmodified
fields, therefore add an awful toggle to handle this
Task 2150302
Probably todo in the future:
* better UI for change-tracking dict, should have "snapshot"
support (to freeze / discard previous changes)
* cleanup save, it's unclear that it properly resets the form
closes odoo/odoo#43117
Signed-off-by:
Xavier Morel (xmo) <xmo@odoo.com>
Showing
- odoo/addons/test_testing_utilities/ir.model.access.csv 2 additions, 0 deletionsodoo/addons/test_testing_utilities/ir.model.access.csv
- odoo/addons/test_testing_utilities/models.py 20 additions, 0 deletionsodoo/addons/test_testing_utilities/models.py
- odoo/addons/test_testing_utilities/tests/test_form_impl.py 38 additions, 0 deletionsodoo/addons/test_testing_utilities/tests/test_form_impl.py
- odoo/tests/common.py 82 additions, 40 deletionsodoo/tests/common.py
Loading
Please register or sign in to comment