Using external IDs and namespaces
Records in Odoo are identified using external IDs or XML IDs. We have utilized XML IDs so far in this book in areas such as views, menus, and actions, but we still don’t know what an XML ID is. This recipe will give you more clarity about it.
How to do it...
We will write in the already-existing records to demonstrate how to use cross-module references:
- Update the manifest file of the
my_hostel
module by registering a data file like this:'data': [ 'data/data.xml', ],
- Create a new room in the
hostel.room
model:<record id="hostel_room" model="hostel.room"> <field name="name"> Hostel Room 01 </field> </record>
- Change the name of the main company:
<record id="base.main_company" model="res.company"> <field name="name">Packt Publishing</field> </record>
Install the module to apply the changes. After...