Daily updates from Odoo
Thursday, December 5, 2024
1 change · master
Resolved issues and error corrections
This fix ensures Point of Sale screens refresh properly when orders are added or removed. It prevents outdated order tabs from staying visible, improving reliability for staff managing active or floating orders.
Original PR description
The records cache (from `related_models` module) isn't properly linked to the reactivity of `posmodel`. As a result, some expected rerenderings aren't executed. An example of this is the `OrderTab`.…
The records cache (from `related_models` module) isn't properly linked to the reactivity of `posmodel`. As a result, some expected rerenderings aren't executed. An example of this is the `OrderTab`. When a new floating order is created the `OrderTab` rerenders listing the new order. However, when that empty order is deleted, the corresponding tab item isn't removed in the list. That is because the `OrderTab`'s render method isn't properly subscribed to the changes in `models['pos.order']`. The render subscription doesn't exist because `models['pos.order'].readAll` isn't reading on the reactive version of the `records` cache. That is because `get orderedRecords` is pointing to the non-reactive version of `records`. `get records` exists in `models` and that's what we should use to properly link it to the reactivity and that `OrderTab` properly subscribes `models['pos.order']`. In this PR we are making sure that the methods of `models` (return value of `createCRUD`) is properly using the `reactive` version of the `records` cache. We then pass that version to the CRUD methods to ensure continuity of reactivity in the records. We also need to make changes in the `OrderTab` template, converting `floating-order-container` from `id` to `class` since it's being used for each order. We should not have multiple instances of an id in the html. TASK-ID: 4369054