[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) <nle@odoo.com>
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2021-01-21 17:57:14 +00:00
parent 5e1cb4b498
commit 4ffa07a884
2 changed files with 6 additions and 3 deletions
@@ -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):
@@ -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.