-
- Downloads
[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 throttle the rpc and to use
"DropMisordered" on 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
Finally the event of the configurator mixin and the widgets using it have been
cleaned to avoid the duplication of the rpc in the first place.
opw-1959317
PR: #32691
Signed-off-by:
Quentin Smetz (qsm) <qsm@odoo.com>
Showing
- addons/product/models/product_template.py 22 additions, 24 deletionsaddons/product/models/product_template.py
- addons/sale/controllers/product_configurator.py 8 additions, 1 deletionaddons/sale/controllers/product_configurator.py
- addons/sale/static/src/js/product_configurator_mixin.js 88 additions, 90 deletionsaddons/sale/static/src/js/product_configurator_mixin.js
- addons/sale/static/src/js/product_configurator_modal.js 23 additions, 14 deletionsaddons/sale/static/src/js/product_configurator_modal.js
- addons/sale/static/src/js/product_configurator_renderer.js 20 additions, 1 deletionaddons/sale/static/src/js/product_configurator_renderer.js
- addons/sale_management/static/tests/product_configurator_test_ui.js 3 additions, 13 deletions...e_management/static/tests/product_configurator_test_ui.js
- addons/website_sale/static/src/js/website_sale.js 16 additions, 24 deletionsaddons/website_sale/static/src/js/website_sale.js
- addons/website_sale/static/src/js/website_sale_options.js 2 additions, 3 deletionsaddons/website_sale/static/src/js/website_sale_options.js
Loading
Please register or sign in to comment