diff options
| author | Xavier Morel <xmo@odoo.com> | 2019-02-21 10:20:49 +0000 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2019-02-26 13:18:57 +0000 |
| commit | e36ad5b0b01aca802e835b82e1fbb79a0d40e659 (patch) | |
| tree | ed539cff24b2c283a73cbbcd2c0c2451432ebf26 /odoo/addons/test_testing_utilities/models.py | |
| parent | ca6d495ebf489d4388bebdbc20dd410fb6324919 (diff) | |
[FIX] core: handling of o2m record deletion in SSF
The SSF would properly mark its own records as deleted, but it would
not properly handle deletion requests coming from an onchange, and it
would not necessarily convert DELETE_ALL commands (5) into the proper
sequence of individual (2)s matching existing records.
closes odoo/odoo#31431
Diffstat (limited to 'odoo/addons/test_testing_utilities/models.py')
| -rw-r--r-- | odoo/addons/test_testing_utilities/models.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/odoo/addons/test_testing_utilities/models.py b/odoo/addons/test_testing_utilities/models.py index ffb27cd08d8..dee6dff08fb 100644 --- a/odoo/addons/test_testing_utilities/models.py +++ b/odoo/addons/test_testing_utilities/models.py @@ -211,3 +211,25 @@ class M2OOnchangeLine(models.Model): @api.onchange('dummy') def _onchange_flag(self): self.flag = True + +class O2MChangeCount(models.Model): + _name = 'test_testing_utilities.onchange_count' + _description = _name + + count = fields.Integer() + line_ids = fields.One2many('test_testing_utilities.onchange_count_sub', 'parent') + + @api.onchange('count') + def _onchange_count(self): + Sub = self.env['test_testing_utilities.onchange_count_sub'] + recs = Sub + for i in range(self.count): + recs |= Sub.new({'name': str(i)}) + self.line_ids = recs + +class O2MChangeSub(models.Model): + _name = 'test_testing_utilities.onchange_count_sub' + _description = _name + + parent = fields.Many2one('test_testing_utilities.onchange_count') + name = fields.Char() |
