From 4ffa07a884b84609e8ac083d575fc588b52ae7b2 Mon Sep 17 00:00:00 2001 From: "Andrea Grazioso (agr-odoo)" Date: Thu, 21 Jan 2021 14:58:59 +0000 Subject: [PATCH] [FIX] purchase_product_matrix,sale_product_matrix: not lose warn msg Set up a DEMO product with - warning message on sale - variant - Order Grid Entry as Sales Variant Selection Create SO, configure this product Warning message doesn't display opw-2442352 closes odoo/odoo#64894 X-original-commit: 50ccbdb983fda289cb9fe740ae711d510386d878 Signed-off-by: Nicolas Lempereur (nle) Signed-off-by: agr-odoo --- addons/purchase_product_matrix/models/purchase.py | 4 +++- addons/sale_product_matrix/models/sale_order.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/purchase_product_matrix/models/purchase.py b/addons/purchase_product_matrix/models/purchase.py index bb55063e097..13023640b2f 100644 --- a/addons/purchase_product_matrix/models/purchase.py +++ b/addons/purchase_product_matrix/models/purchase.py @@ -98,10 +98,12 @@ class PurchaseOrder(models.Model): product_no_variant_attribute_value_ids=no_variant_attribute_values.ids) )) if new_lines: + res = False self.update(dict(order_line=new_lines)) for line in self.order_line.filtered(lambda line: line.product_template_id == product_template): - line._product_id_change() + res = line._product_id_change() or res line._onchange_quantity() + return res def _get_matrix(self, product_template): def has_ptavs(line, sorted_attr_ids): diff --git a/addons/sale_product_matrix/models/sale_order.py b/addons/sale_product_matrix/models/sale_order.py index a504416274c..6ce55c5ddf0 100644 --- a/addons/sale_product_matrix/models/sale_order.py +++ b/addons/sale_product_matrix/models/sale_order.py @@ -109,12 +109,13 @@ class SaleOrder(models.Model): product_no_variant_attribute_value_ids=no_variant_attribute_values.ids) )) if new_lines: + res = False self.update(dict(order_line=new_lines)) for line in self.order_line.filtered(lambda line: line.product_template_id == product_template): - line.product_id_change() + res = line.product_id_change() or res line._onchange_discount() line._onchange_product_id_set_customer_lead() - + return res def _get_matrix(self, product_template): """Return the matrix of the given product, updated with current SOLines quantities.