Import XML data based on unique key values
Some data have natural unique keys like for language the code.
Usually we generate an XML id
using this code.
But this has drawback when a new record is added but the unique key already exist in the database (for example users may have created the record).
So the idea is to allow to add to the <record>
tag, in addition to the id
attribute, a search
attribute which contains a domain to find the record if it does not exist in the ir.model.data
.
For example for the language:
<record model="ir.lang" id="lang_fr" search="[('code', '=', 'fr')]">
<field name="code">fr</field>
<field name="name">French</field>
...
</record>