[FIX] product_visible_discount: Correction in the __openerp__.py for the dependency...
authorskh <skh@tinyerp.com>
Tue, 31 May 2011 09:32:10 +0000 (15:02 +0530)
committerskh <skh@tinyerp.com>
Tue, 31 May 2011 09:32:10 +0000 (15:02 +0530)
bzr revid: skh@tinyerp.com-20110531093210-k75iw1zhx6u8z1l2

addons/product_visible_discount/__openerp__.py
addons/product_visible_discount/product_visible_discount.py

index 8e59bc3..0bbb9c1 100644 (file)
@@ -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,
index b347321..dcd2641 100644 (file)
@@ -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)