Odoo 11 Development Cookbook - Second Edition - Second Edition
by Alexandre Fayolle, Holger Brunn
How it works...
An XML ID is a string referring to a record in the database. The IDs themselves are records of model ir.model.data. This table's rows contain the module declaring the XML ID in the first place, the identifier string, the referred model, and the referred ID. Every time an XML ID has to be written to, Odoo checks whether the string is namespaced already (that is, it contains exactly one dot), and if not, it adds the current module name as namespace. Then, it looks up whether there is already a record in ir.model.data with the specified name. If so, an UPDATE statement for the listed fields is executed; if not, a CREATE statement is executed. This is why you can give partial data when a record already exists, as we did earlier. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access