diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index 02b2605d8cf..3c1d5febc75 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -445,9 +445,14 @@ class product_pricelist_item(osv.osv): if price_min_margin > price_max_margin: res['warning'] = {'title': _('Warning!'), 'message': _('Minimum Margin must be lower than Maximum Margin !.')} pricelist_rule = self.browse(cr, uid, ids, context=context)[0] - min_margin = pricelist_rule.price_min_margin - max_margin = pricelist_rule.price_max_margin - res['value'].update({'price_min_margin': min_margin, 'price_max_margin': max_margin}) + min_margin = 0.0 + max_margin = 0.0 + if price_min_margin: + min_margin = pricelist_rule.price_min_margin + res['value'].update({'price_min_margin': min_margin}) + if price_max_margin: + max_margin = pricelist_rule.price_max_margin + res['value'].update({'price_max_margin': max_margin}) return res product_pricelist_item() diff --git a/addons/product/pricelist_view.xml b/addons/product/pricelist_view.xml index 7dcdeae15e8..47fada812d2 100644 --- a/addons/product/pricelist_view.xml +++ b/addons/product/pricelist_view.xml @@ -107,8 +107,8 @@ - - + +