summaryrefslogtreecommitdiff
path: root/addons/product_matrix
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2021-01-14 09:53:26 +0000
committerAaron Bohy <aab@odoo.com>2021-01-14 14:22:24 +0000
commit69cadbe1be6320d96fe9bc5bf8dd808f87d735c0 (patch)
tree323a47589b17f1fca0efe12646ef5c90fb9cd14d /addons/product_matrix
parent8dfee8cb2d60942641b73eaa6489b02aa378c5ac (diff)
[FIX] web, purchase_product_matrix: can open twice the matrix
Let's assume the following scenario with 'purchase_product_matrix' module installed: - create a new Purchase Order - add a line in the one2many - select "Customizable desk" as product - [the desk matrix opens] - close the matrix - select "Conference chair" instead - [the desk matrix opens, whereas it should be the chair one] It didn't work because of a small bug in the FieldOne2Many. This field is configured to be reset when any other field in the view changes. The product configurator feature relies on that. However, when another field changes, the One2Many didn't update its internal state with the new record (and it skipped the rendering, which is fine). The matrix product configurator thus read an obsolete value in the internal of the one2many. Since the internal state is now always up-to-date, we can directly read there the grid information, instead of looking inside other fields that have been updated (attempt done in [1]) It would be nice to rethink the whole product configurator stuff in master, to make it more robust, maybe when converting it to owl? [1] https://github.com/odoo/odoo/commit/21bcafc053be7f80eed7a684fee2dc1e3caaafa5 opw~2421798 closes odoo/odoo#64552 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Diffstat (limited to 'addons/product_matrix')
-rw-r--r--addons/product_matrix/static/src/js/section_and_note_widget.js13
1 files changed, 2 insertions, 11 deletions
diff --git a/addons/product_matrix/static/src/js/section_and_note_widget.js b/addons/product_matrix/static/src/js/section_and_note_widget.js
index 3cdddf0f596..650efbf22af 100644
--- a/addons/product_matrix/static/src/js/section_and_note_widget.js
+++ b/addons/product_matrix/static/src/js/section_and_note_widget.js
@@ -71,17 +71,8 @@ SectionAndNoteFieldOne2Many.include({
grid_product_tmpl_id: {id: productTemplateId}
},
viewType: 'form',
- onSuccess: function (result) {
- // result = list of widgets
- // find one of the SO widget
- // (not so lines because the grid values are computed on the SO)
- // and get the grid information from its recordData.
- var gridInfo = result.find(
- r => r.recordData.grid && r.recordData.grid.includes("header")
- ).recordData.grid;
- // includes "header" is necessary to ensure the correct data is taken
- // because the grid data isn't correctly updated in all widgets
- // when in an new record environment.
+ onSuccess: function () {
+ const gridInfo = self.recordData.grid;
self._openMatrixConfigurator(gridInfo, productTemplateId, editedCellAttributes);
}
});