[FIX] warning: Products with Blocking Warnings can still be added to Sales Orders

Like in 8.0 when adding a product with a blocking message in a SO line, a warning
message must be raised and the product is not added.

opw:685928
This commit is contained in:
Goffin Simon
2016-08-18 13:22:34 +02:00
parent 354017b805
commit c0bb312a26
+10
View File
@@ -233,6 +233,16 @@ class sale_order_line(osv.osv):
return result
@api.onchange('product_id')
def product_id_change(self):
warning = self.onchange_product_id_warning()
product_info = self.product_id
if product_info.sale_line_warn != 'no-message':
if product_info.sale_line_warn == 'block':
return warning
result = super(sale_order_line, self).product_id_change()
result['warning'] = warning and warning.get('warning')
return result
def onchange_product_id_warning(self):
if not self.product_id:
return