summaryrefslogtreecommitdiff
path: root/odoo/addons/test_testing_utilities/models.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-04-05 18:46:10 +0200
committerChristophe Simonis <chs@odoo.com>2019-04-05 18:46:10 +0200
commit3f95b074e959f0f4ac93fbf4048c0c7276f2c17a (patch)
treef4e793da5d83bcd1bd4347f71cb3f45cbc953df3 /odoo/addons/test_testing_utilities/models.py
parent1a871d72438c731d08ef10e668b81b4ade900b85 (diff)
parentf2be461f0906ed47306da58c31240014b6239d80 (diff)
[MERGE] forward port branch saas-12.2 up to f2be461f090
Diffstat (limited to 'odoo/addons/test_testing_utilities/models.py')
-rw-r--r--odoo/addons/test_testing_utilities/models.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/odoo/addons/test_testing_utilities/models.py b/odoo/addons/test_testing_utilities/models.py
index fbdec47a7cf..0c04bc06e8d 100644
--- a/odoo/addons/test_testing_utilities/models.py
+++ b/odoo/addons/test_testing_utilities/models.py
@@ -188,6 +188,13 @@ class O2MSub3(models.Model):
r.name = str(r.v)
+class O2MRecursive(models.Model):
+ _name = _description = 'test_testing_utilities.recursive'
+
+ one_to_many_id = fields.Many2one('test_testing_utilities.recursive', readonly=True)
+ many_to_one_ids = fields.One2many('test_testing_utilities.recursive', 'one_to_many_id', readonly=True)
+
+
class O2MOnchangeParent(models.Model):
_name = 'test_testing_utilities.onchange_parent'
_description = 'Testing Utilities Onchange Parent'
@@ -233,3 +240,24 @@ class O2MChangeSub(models.Model):
parent = fields.Many2one('test_testing_utilities.onchange_count')
name = fields.Char()
+
+class O2MReadonlySubfield(models.Model):
+ _name = 'o2m_readonly_subfield_parent'
+ _description = _name
+
+ line_ids = fields.One2many('o2m_readonly_subfield_child', 'parent_id')
+
+class O2MReadonlySubfieldChild(models.Model):
+ _name = _description = 'o2m_readonly_subfield_child'
+
+ name = fields.Char()
+ parent_id = fields.Many2one('o2m_readonly_subfield_parent')
+ f = fields.Integer(compute='_compute_f', inverse='_inverse_f', readonly=True)
+
+ @api.depends('name')
+ def _compute_f(self):
+ for r in self:
+ r.f = len(r.name) if r.name else 0
+
+ def _inverse_f(self):
+ raise AssertionError("Inverse of f should not be called")