Hierarchies are represented using model relations with itself; each record has a parent record in the same model and also has many child records. This can be achieved by simply using many-to-one relations between the model and itself.
But Odoo also provides improved support for this type of field using the Nested set model (https://en.wikipedia.org/wiki/Nested_set_model). When activated, queries using the
child_of operator in their domain filters will run significantly faster.
Staying with the Library Books example, we will build a hierarchical category tree that could be used to categorize books.
We will reuse the
my_module addon module from Chapter 3, Creating Odoo Modules.
We will add a new ...