Files
odoo_source/odoo/addons/test_testing_utilities/ir.model.access.csv
T
Xavier Morel ac3cb21836 [FIX] SSF: handle o2m nesting
The SSF had pretty much punted on nested o2m as that's... not usually
a concern because few people are insane enough to put o2ms in their
o2ms in their views. And also because even if somebody did, sometimes
nothing would break because it turns out to be pretty difficult to
actually get into *using* those things.

MRP managed to do it though, and repro-ing required copying over parts
of mrp.production and then understanding why it didn't fail:

* obviously needs an o2m (f1) which contains an o2m (f2), in the
  view (an invisible tree inside a visible tree)
* needs an onchange which somehow updates the sub-o2m
* needs to actually trigger an onchange on the root form for f1,
  meaning f1 must be a dependency of a compute field or something (here
  I just marked every damn field as on_change as the optimisation of
  "don't call onchange when there's no need to" doesn't matter)

Also needs to be working on an existing record with existing
lines *and sublines* as the issue occurs with records to update.

The issue here is that `_onchange_values` would clean up f1 e.g. send
nothing for unmodified entries, and only send modified fields
otherwise, but it would only do so for the toplevel, meaning the
sub-level would not go through this step, and could send UPDATE
commands with an `id` field (set to the original value but
still). This would then proceed to blow up while loading the record,
as id fields are not writeable.

The fix is to perform `_onchange_values` recursively. Do that using a
separate helper in order to avoid blowing up on override and whatnot,
or faffling about with weird branching to get the "default" values in
case they're not provided, the root function can get all the relevant
bits and call the helper with them, then the helper does that setup
internally and calls itself directly.

An other issue I stumbled upon when investigating is a similar problem
on *save*, due to an implementation detail of the SSF: UPDATE commands
are fetched lazily.

`_values_to_save` took care of "hydrating" all update commands (and
validating and filtering them) of modified o2m fields, but as it would
not do so recursively a modified f2 would not get properly hydrated
and filtered, and could try to write `None` onto existing records.

closes odoo/odoo#51350

X-original-commit: 3dfb4cfad849936748cc6a5b8f712e100461a86f
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-05-15 14:53:20 +00:00

3.1 KiB

1idnamemodel_id:idgroup_id:idperm_readperm_writeperm_createperm_unlink
2access_test_testing_utilities_aaccess_test_testing_utilities_amodel_test_testing_utilities_a1000
3access_test_testing_utilities_readonlyaccess_test_testing_utilities_readonlymodel_test_testing_utilities_readonly1000
4access_test_testing_utilities_caccess_test_testing_utilities_cmodel_test_testing_utilities_c1000
5access_test_testing_utilities_daccess_test_testing_utilities_dmodel_test_testing_utilities_d1000
6access_test_testing_utilities_eaccess_test_testing_utilities_emodel_test_testing_utilities_e1000
7access_test_testing_utilities_faccess_test_testing_utilities_fmodel_test_testing_utilities_f1000
8access_test_testing_utilities_gaccess_test_testing_utilities_gmodel_test_testing_utilities_g1000
9access_test_testing_utilities_m2oaccess_test_testing_utilities_m2omodel_test_testing_utilities_m2o1000
10access_test_testing_utilities_defaultaccess_test_testing_utilities_defaultmodel_test_testing_utilities_default1000
11access_test_testing_utilities_parentaccess_test_testing_utilities_parentmodel_test_testing_utilities_parent1000
12access_test_testing_utilities_subaccess_test_testing_utilities_submodel_test_testing_utilities_sub1000
13access_test_testing_utilities_sub2access_test_testing_utilities_sub2model_test_testing_utilities_sub21000
14access_test_testing_utilities_sub3access_test_testing_utilities_sub3model_test_testing_utilities_sub31000
15access_test_testing_utilities_recursiveaccess_test_testing_utilities_recursivemodel_test_testing_utilities_recursive1000
16access_test_testing_utilities_onchange_parentaccess_test_testing_utilities_onchange_parentmodel_test_testing_utilities_onchange_parent1000
17access_test_testing_utilities_onchange_lineaccess_test_testing_utilities_onchange_linemodel_test_testing_utilities_onchange_line1000
18access_model_test_testing_utilities_onchange_countaccess_model_test_testing_utilities_onchange_countmodel_test_testing_utilities_onchange_count1111
19access_test_testing_utilities_onchange_count_subaccess_test_testing_utilities_onchange_count_submodel_test_testing_utilities_onchange_count_sub1111
20access_o2m_readonly_subfield_parentaccess_o2m_readonly_subfield_parentmodel_o2m_readonly_subfield_parent1111
21access_o2m_readonly_subfield_childaccess_o2m_readonly_subfield_childmodel_o2m_readonly_subfield_child1111
22access_test_testing_utilities_req_boolaccess_test_testing_utilities_req_boolmodel_test_testing_utilities_req_bool1000
23access_o2m_changes_childrenaccess_o2m_changes_childrenmodel_o2m_changes_childrenbase.group_user1000
24access_o2m_changes_children_linesaccess_o2m_changes_children_linesmodel_o2m_changes_children_linesbase.group_user1000
25access_ttu_productaccess_ttu_productmodel_ttu_productbase.group_user1000
26access_ttu_rootaccess_ttu_rootmodel_ttu_rootbase.group_user1000
27access_ttu_childaccess_ttu_childmodel_ttu_childbase.group_user1000
28access_ttu_grandchildaccess_ttu_grandchildmodel_ttu_grandchildbase.group_user1000