Tuesday, June 25, 2024
2 changes · 17.0
Enhancements to existing features
This update significantly improves the speed of the POS preparation display system by filtering out completed orders before processing them, rather than processing all orders and filtering afterward. This eliminates unnecessary work when many orders are already done, resulting in dramatic performance improvements—up to 114x faster in scenarios where most orders are completed.
Original PR description
## Changes in the pos_preparation_display/models/preparation_display_order.py: The previous code used to have low selectivity in the initial recordset returned by the search function. Then the…
## Changes in the pos_preparation_display/models/preparation_display_order.py: The previous code used to have low selectivity in the initial recordset returned by the search function. Then the records were filtered on their state inside the for loop which increased the number of get requests to view the order stages. This approach caused a bottleneck in the following situation: - All the records are in the done stage and will be processed to filter them out, but not viewed which takes a lot of resources and no result in the end. - Some of the records are in the done stage, This would add an overhead to the processing of the function with irrelevant records to filter out the done orders. Solution: - Reduce the recordset being returned in the first place from the search function by adding filters to return only the ones in progress by running an `_read_group` function that returns the orders that do not have a completed stage in the current preparation display. This recordset is then added to the new orders that still do not have stages and are in the current preparation display as well. ## Changes in the pos_preparation_display/models/preparation_display.py: The previous code would process all the records to be in the done state even though they could be already done. This approach causes an issue in the following situation: - All the records are archived, but pressing on archive all again, processes all the records again with no benefit added. Solution: - Same as above, reduce the recordset to return the orders still in progress only. Also note that the reset was limited for 1000 records only and with the previous setup, pressing archive multiple times would result in the same processing over the same 1000 records, Which is why the limit was removed ## Benckmark | | Before| After| Orders done | Number of records |Speed up |---|----|-----|------|---------|--------- Time | 15 s | 12 s | No | 170k |1.25x Time | 6 s | 302 ms | yes| 170k |19x This speed up is because all of the records are archived and put in the done state thus not selected by the _read_group function in the first place. Under different circumstances the speed up would differ on the ratio between done and not done orders. But under the assumption that the number of orders on the display order at a single time, the speed up is considerable. ## Reference opw-3865664 Forward-Port-Of: odoo/enterprise#62996
Resolved issues and error corrections
This fix resolves a conflict that occurs when both the Shiprocket and UPS shipping modules are installed together, which was causing the payment page to crash with an error. The issue has been corrected so customers can complete their purchases without encountering technical errors.
Original PR description
When the website_sale_ups module is installed, it will conflict between the same code `this.codOptions` and throw the traceback on the payment page says 'Cannot read properties of undefined (reading 'classList')' related PR-https://github.com/odoo/enterprise/pull/56663