[FIX] web,*: fix race condition with m2o quick create
*sale,sale_product_configurator Let's assume a form view containing a many2one with an onchange that updates the value of a one2many. Do a quick create in the many2one. While the name_create request is pending, add a row to the one2many but do not leave it. When the name_create returns, and the onchange has been performed, the one2many is reset, and the row is no longer in edition (worse, it could be invalid, i.e. in a state that the user could not have reached in a normal situation). This commit fixes this issue by considering the whole [name_create + onchange] operation as one. This operation is executed in the mutex of the model, so the other request (adding a row to the one2many) is delayed until the many2one value has been correctly set. This fixes an issue with the sale and rental tours (on sale_order), that had been deactivated for a while.
Showing
- addons/sale/static/src/js/product_configurator_widget.js 13 additions, 14 deletionsaddons/sale/static/src/js/product_configurator_widget.js
- addons/sale_product_configurator/static/src/js/product_configurator_widget.js 5 additions, 3 deletions...configurator/static/src/js/product_configurator_widget.js
- addons/web/static/src/js/fields/relational_fields.js 3 additions, 14 deletionsaddons/web/static/src/js/fields/relational_fields.js
- addons/web/static/src/js/views/basic/basic_model.js 44 additions, 6 deletionsaddons/web/static/src/js/views/basic/basic_model.js
- addons/web/static/tests/fields/relational_fields/field_many2one_tests.js 1 addition, 0 deletions...ic/tests/fields/relational_fields/field_many2one_tests.js
- addons/web/static/tests/fields/relational_fields/field_one2many_tests.js 50 additions, 0 deletions...ic/tests/fields/relational_fields/field_one2many_tests.js
- addons/web/static/tests/fields/relational_fields_tests.js 23 additions, 0 deletionsaddons/web/static/tests/fields/relational_fields_tests.js
Loading
Please register or sign in to comment