From a98ba79ae4929fe31402d26b2fc312157116a292 Mon Sep 17 00:00:00 2001 From: skh Date: Tue, 31 May 2011 15:02:10 +0530 Subject: [PATCH] [FIX] product_visible_discount: Correction in the __openerp__.py for the dependency module and fix the code for the product pricelist item(Ref : Case 5998) bzr revid: skh@tinyerp.com-20110531093210-k75iw1zhx6u8z1l2 --- addons/product_visible_discount/__openerp__.py | 2 +- addons/product_visible_discount/product_visible_discount.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/product_visible_discount/__openerp__.py b/addons/product_visible_discount/__openerp__.py index 8e59bc395d7..0bbb9c1e2c5 100644 --- a/addons/product_visible_discount/__openerp__.py +++ b/addons/product_visible_discount/__openerp__.py @@ -30,7 +30,7 @@ If the check box is checked, we will have on the sale order line: Unit price=450, Discount=50,00, Net price=225 If the check box is unchecked, we will have on Sale Order and Invoice lines: Unit price=225, Discount=0,00, Net price=225 """, - "depends": ["sale"], + "depends": ["sale","purchase"], "demo_xml": [], "update_xml": ['product_visible_discount_view.xml'], "active": False, diff --git a/addons/product_visible_discount/product_visible_discount.py b/addons/product_visible_discount/product_visible_discount.py index b347321bebe..dcd2641b184 100644 --- a/addons/product_visible_discount/product_visible_discount.py +++ b/addons/product_visible_discount/product_visible_discount.py @@ -114,11 +114,10 @@ class account_invoice_line(osv.osv): product_obj = self.pool.get('product.product') template_obj = self.pool.get('product.template') field_name = 'list_price' - if res_dict.get('item_id',False) and res_dict['item_id'].get(pricelist,False): item = res_dict['item_id'].get(pricelist,False) - item_base = item_obj.read(cr, uid, [item], ['base'])[0]['base'] - if item_base > 0: + item_base = item_obj.read(cr, uid, [item], ['base']) + if item_base and item_base[0]['base'] > 0: field_name = price_type_obj.browse(cr, uid, item_base).field product = product_obj.browse(cr, uid, product_id, context)