December 2018
Beginner to intermediate
404 pages
10h 14m
English
For many-to-one relation fields, the value to write is the database ID for the linked record. In XML files, we usually know the XML ID for the record, and we need to have it translated into the actual database ID.
One way is to use the eval attribute with a ref() function, like we just did in the previous section.
A simpler alternative is to use the ref attribute, which is available for <field> elements. Using it to set the value for the publisher_id many-to-one field, we would write the following:
<field name="publisher_id" ref="res_partner_packt" />
Read now
Unlock full access