Daily updates from Odoo
Wednesday, February 28, 2018
1 change · master
Code cleanup and technical improvements
Odoo’s internal handling of hierarchical records was redesigned to make parent-child searches faster and easier to maintain. This improves reliability during concurrent updates and affects business areas that rely on structured records such as products, stock locations, accounts, menus, partners, and website content.
Original PR description
This replaces the former modified preorder tree traversal (MPTT) with the
fields `parent_left`/`parent_right`. Each record is associated to a string
`parent_path`, that represents the path from its root node to itself. The path
is made of the node ids suffixed with a slash:
a node | id | parent_path
/ \ a | 42 | 42/
... b b | 63 | 42/63/
/ \ c | 84 | 42/63/84/
c d d | 85 | 42/63/85/
This field provides an efficient implementation for parent_of/child_of queries:
the nodes in the subtree of record are the ones where `parent_path` starts with
the `parent_path` of record. It is also more efficient to maintain than the
MPTT fields, and less sensitive to concurrent updates, because the value of
`parent_path` does not depend on sibling nodes.