Files
odoo_source/odoo/addons/test_convert
6367a89332 [FIX] core: import of o2m with recursive xml declaration
Let's imagine this data

```xml
<record model="my.model" id="1">
    <field name="name">parent</field>
    <field name="children_ids">
	<record model="my.model" id="1.1">
	    <field name="name">child</field>
	</record>
    </field>
</record>
```

Loading this data the first time, everything works fine.
But if we update it, this is what happens:
* load `my.model,1`: write on `name=parent` and `children_ids=None`
* load `my.model,1.1`: write on `name=child` and `parent_id=my.model,1`

The write on `children_ids=None` can unlink all the children if the
field is declared as `ondelete=cascade`
That will leade in all the records to be deleted and recreated, but
without keeping links with other documents.

For instance, when upgrading the `account` module, all the
`account.account.tag` are removed from `account.move.line` because when
the `account.tax.report.line` are updated, all the tags are deleted and
recreated.

closes odoo/odoo#82793

X-original-commit: de00316fa42173f3a5c394458bb4418e59e298cd
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
Co-authored-by: rco-odoo <rco@odoo.com>
Co-authored-by: jva-odoo <jva@odoo.com>
Co-authored-by: william-andre <wan@odoo.com>
2022-01-14 16:37:50 +00:00
..
…