Please sign in to comment.
[FIX] product,sale,website_sale: compute combination possible in rpc
This has several advantages: - make the code easier to maintain by having the logic only on the python model - prevent price flickering when changing from/to an impossible combination - fix the UI for the issue mentioned in the previous commit/the opw - make the code much faster when using many combinations, by not requiring to browse and to return every existing and every archived variants The opportunity is also taken to properly debounce the rpc and/or its result: - fix all the other remaining flickering when changing quantity or combination - fix the server being spammed of rpc when using the configurator modal, but also in a lot of other cases such as incrementing the quantity, ... - fix UI consistency by ensuring the result of the last rpc is always the one displayed, obsolete rpc returns are ignored By computing the possibility of the combination asynchronously, the two drawbacks are: - the UI is a bit less reactive than in the previously the best case scenario, but this almost completely mitigated by debouncing with a leading call - it is possible for a quick user to click on "add to cart" on an impossible combination before the return of the rpc, but this is not really an issue because when the product will be added to cart there will a check and the closest possible combination will be selected automatically instead opw-1959317 PR: #32691
- Loading branch information...
Showing with 213 additions and 131 deletions.
- +22 −24 addons/product/models/product_template.py
- +8 −1 addons/sale/controllers/product_configurator.py
- +127 −90 addons/sale/static/src/js/product_configurator_mixin.js
- +21 −0 addons/sale/static/src/js/product_configurator_modal.js
- +16 −1 addons/sale/static/src/js/product_configurator_renderer.js
- +3 −13 addons/sale_management/static/tests/product_configurator_test_ui.js
- +16 −2 addons/website_sale/static/src/js/website_sale.js
Oops, something went wrong.