diff options
| author | Raphael Collet <rco@odoo.com> | 2021-02-25 16:56:52 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2021-02-26 15:07:09 +0000 |
| commit | b2235e2749504e6eee9e6f8090d1df54cf5971b7 (patch) | |
| tree | 86c8f4a989f05e3f7914d56335fafe0ab09aabb8 /odoo/addons/test_new_api/tests/test_new_fields.py | |
| parent | 71cc7212b1c1abad5d37e29f3a1f33f6e6cd2a81 (diff) | |
[FIX] core: convert_to_write() of x2many field with new records
When comparing the values of a new record with its origin, x2many fields
are always different because we compare new records with real records.
For instance, converting the value of a one2many field where lines have
a many2many field always returns update commands for the many2many
field.
closes odoo/odoo#66937
X-original-commit: 03a4137cc3fa398dbd0cb214dc5472a083ae33b8
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'odoo/addons/test_new_api/tests/test_new_fields.py')
| -rw-r--r-- | odoo/addons/test_new_api/tests/test_new_fields.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/odoo/addons/test_new_api/tests/test_new_fields.py b/odoo/addons/test_new_api/tests/test_new_fields.py index 3efb67ce3e2..5a50f5b2b18 100644 --- a/odoo/addons/test_new_api/tests/test_new_fields.py +++ b/odoo/addons/test_new_api/tests/test_new_fields.py @@ -1651,6 +1651,16 @@ class TestFields(TransactionCaseWithUserDemo): self.assertNotEqual(new_disc.participants, disc.participants) self.assertEqual(new_disc.participants._origin, disc.participants) + # check convert_to_write + tag = self.env['test_new_api.multi.tag'].create({'name': 'Foo'}) + rec = self.env['test_new_api.multi'].create({ + 'lines': [(0, 0, {'tags': [(6, 0, tag.ids)]})], + }) + new = rec.new(origin=rec) + self.assertEqual(new.lines.tags._origin, rec.lines.tags) + vals = new._convert_to_write(new._cache) + self.assertEqual(vals['lines'], [(6, 0, rec.lines.ids)]) + def test_41_new_compute(self): """ Check recomputation of fields on new records. """ move = self.env['test_new_api.move'].create({ |
