diff options
| author | Xavier Morel <xmo@odoo.com> | 2019-09-24 13:22:25 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-09-25 16:37:19 +0000 |
| commit | 77099c54b602eb1a71c2a176eeebcceefaf7aec6 (patch) | |
| tree | 285eed8e714dab9e5dae740f74b24eba656b7742 /odoo/addons/test_testing_utilities | |
| parent | 98b7129e20979a4dbbeb72ea1109112744f813d5 (diff) | |
[FIX] core: o2m modifiers in the SSF
Because the sub-record values would not necessarily get fetched
ever (whether default or stored), the computation of modifiers might
blow up if it relied on one of the un-fetched un-specified fields.
One such situation is trying to create a partner with child partners
if base_address_city is installed: the module adds a readonly attr
predicated upon the parent_id, without explicitly providing such the
field would be missing from the O2M record's values.
Closes #37176
closes odoo/odoo#37452
X-original-commit: 184d1b69eac2b78c72228c81c5c6cf8cc4a56eb4
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Diffstat (limited to 'odoo/addons/test_testing_utilities')
| -rw-r--r-- | odoo/addons/test_testing_utilities/menu.xml | 15 | ||||
| -rw-r--r-- | odoo/addons/test_testing_utilities/tests/test_form_impl.py | 11 |
2 files changed, 26 insertions, 0 deletions
diff --git a/odoo/addons/test_testing_utilities/menu.xml b/odoo/addons/test_testing_utilities/menu.xml index 60789cb490c..52bdeba2399 100644 --- a/odoo/addons/test_testing_utilities/menu.xml +++ b/odoo/addons/test_testing_utilities/menu.xml @@ -164,4 +164,19 @@ </form> </field> </record> + + <record id="o2m_modifier" model="ir.ui.view"> + <field name="name">Modifier check</field> + <field name="model">test_testing_utilities.parent</field> + <field name="inherit_id" ref="o2m_parent"/> + <field name="mode">primary</field> + <field name="arch" type="xml"> + <field name="subs" position="inside"> + <form> + <field name="value" attrs="{'readonly': [('v', '!=', False)]}"/> + <field name="v"/> + </form> + </field> + </field> + </record> </odoo> diff --git a/odoo/addons/test_testing_utilities/tests/test_form_impl.py b/odoo/addons/test_testing_utilities/tests/test_form_impl.py index c0e5093fd3b..a7cd141696c 100644 --- a/odoo/addons/test_testing_utilities/tests/test_form_impl.py +++ b/odoo/addons/test_testing_utilities/tests/test_form_impl.py @@ -497,6 +497,17 @@ class TestO2M(TransactionCase): def test_o2m_self_recursive(self): Form(self.env['test_testing_utilities.recursive'], view='test_testing_utilities.o2m_recursive_relation_view') + def test_o2m_attrs(self): + Model = self.env['test_testing_utilities.parent'].with_context( + default_subs=[{ + 'value': 5, + }, { + 'value': 7, + }] + ) + f = Form(Model, view='test_testing_utilities.o2m_modifier') + f.save() + class TestEdition(TransactionCase): """ These use the context manager form as we don't need the record post-save (we already have it) and it's easier to see what bits act on |
