-
- Downloads
[FIX] sale: sol_product_many2one should not crash
The `sol_product_many2one` field is a sub many2one field that should
open the proper configuration system, such as the product configurator.
Before this commit, when inputting some data, then clicking on another
notebook tab, we would often see a crash, because the field has been
destroyed (since it is no longer in the current tab) and it tries to
open the configurator, which requires rpcs.
It is usually a problem when a destroyed component tries to perform some
work. Note that it happens at creation and update. Also, the field
overrides some many2one methods that display confirmation dialog. To fix
this, this commit simplifies the field by only calling the configuration
methods when its value has changed. This is a different strategy that
does not interfere with the many2one basic features. Also, it does not
crash since it will only call the configuration methods on patched, so
it is guaranteed to be alive.
It is certainly not a complete solution, since we should probably move the
code somewhere else not in a field widget, but this would require a
redesign of the code, so it is not appropriate in a bug fix anyway.
Note that the tour had to be adapted, since now the methods
_onProductUpdate/_onProductTemplateUpdate are now called in an effect
(so after a render), which is slightly later than before. But the tour
would click on confirm even before the product update code was executed,
which means that the product was not properly configurated.
This is clearly a concurrency problem: the product configuration code
should be properly coordinated with the basic model, but doing so is a
significative change. Also, in practice, it is not worse than before
this commit.
opw 3178297
closes odoo/odoo#123264
Signed-off-by:
Aaron Bohy (aab) <aab@odoo.com>
Showing
- addons/sale/__manifest__.py 2 additions, 1 deletionaddons/sale/__manifest__.py
- addons/sale/static/src/js/sale_product_field.js 7 additions, 32 deletionsaddons/sale/static/src/js/sale_product_field.js
- addons/sale/static/tests/sale_product_field_tests.js 128 additions, 0 deletionsaddons/sale/static/tests/sale_product_field_tests.js
- addons/sale_timesheet/static/tests/tours/sale_timesheet_tour.js 3 additions, 0 deletions.../sale_timesheet/static/tests/tours/sale_timesheet_tour.js
- addons/web/static/src/views/fields/many2one/many2one_field.js 3 additions, 0 deletions...ns/web/static/src/views/fields/many2one/many2one_field.js
Loading
Please register or sign in to comment