From e708ec5345d4e45db0dcaed4211667dfaaa06da0 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 24 Sep 2012 14:12:42 +0530 Subject: [PATCH] [IMP] product : Added warning message on onchange of min/max margin value. bzr revid: mdi@tinyerp.com-20120924084242-v6cly3hpsotn2y4b --- addons/product/pricelist.py | 11 ++++++++--- addons/product/pricelist_view.xml | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) 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 @@ - - + +