Daily updates from Odoo
Friday, March 22, 2024
2 changes
Code cleanup and technical improvements
This update simplifies internal grouping logic used across several Odoo apps, reducing duplicated code and making future maintenance easier. Users should see the same grouping behavior in views and reports, with lower risk of inconsistencies between modules.
Original PR description
### [REF] *: use the default group_expand of fields.Selection The selection field already has a method for `group_expand` (which expands each selection value) called `_default_group_expand`. Unfortunately, it is undocumented and unknown. Use it if possible and remove any clones of it. ### [REF] core, *: remove order parameter of group_expand methods The order sent to group_expand is either None (groups on non-relational fields) or equal to the comodel _order. The only exception is when the order is reversed. To simplify the API, remove this parameter and instead reverse the result if the order is reversed. https://github.com/odoo/odoo/pull/139294
Point of Sale data handling has been reworked so records are linked more consistently with the back office structure. This makes the system easier to reuse in Self-Order flows and should simplify future changes across localized PoS features.
Original PR description
Refactoring of model operation in all Point of Sale modules. The aim is to facilitate access to the various records and enable the use of PoS classes in the Self-Order. Records are now linked as in the backend. This link is managed via field information from the backend (many2many, many2one...). Remapping of field names has also been removed, so that frontend variable names correspond to backend variable names. Example: - Avant order.product.name - Now: order_id.product_id.name Example of model usage: ``` const pos_order = this.pos.models["pos.order"].getAll(); const lineProducts = pos_order.lines.map((l) => l.product); ``` It's very important not to access any more services / dependencies specific to the Point of sale in the model classes, as these will be used outside the PoS. Part 1: https://github.com/odoo/enterprise/pull/51000