From c0bb312a26feb2f1eb144633358956e026be7bf4 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 17 Aug 2016 14:56:12 +0200 Subject: [PATCH] [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 --- addons/warning/warning.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/warning/warning.py b/addons/warning/warning.py index 0c971a2a82e..bead8a1b3a0 100644 --- a/addons/warning/warning.py +++ b/addons/warning/warning.py @@ -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