Hierarchical relationships

Parent-child tree relationships are represented using a Many2one relationship with the same model, so that each record references its parent. The inverse One2many makes it easy for a parent to keep track of its children.

Odoo provides improved support for these hierarchical data structures, for faster browsing through tree siblings, and for easier searches using the additional child_of operator in domain expressions. To enable these features, we need to set the _parent_store flag attribute and add the helper fields parent_left and parent_right to the model. 

Be aware that these additional operations come with storage and execution time penalties, so they are best used when you expect to read more frequently than ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.