[FIX] product_visible_discount: no crash when no pricelist passed or product without company
Fixes an error introduced in f6fb2b6
This commit is contained in:
parent
b7814943c3
commit
37ba23d553
|
@ -67,7 +67,7 @@ class sale_order_line(osv.osv):
|
|||
result=res['value']
|
||||
pricelist_obj=self.pool.get('product.pricelist')
|
||||
product_obj = self.pool.get('product.product')
|
||||
if product:
|
||||
if product and pricelist:
|
||||
if result.get('price_unit',False):
|
||||
price=result['price_unit']
|
||||
else:
|
||||
|
@ -81,7 +81,7 @@ class sale_order_line(osv.osv):
|
|||
|
||||
new_list_price = get_real_price(list_price, product.id, qty, uom, pricelist)
|
||||
if so_pricelist.visible_discount and list_price[pricelist] != 0 and new_list_price != 0:
|
||||
if so_pricelist.currency_id.id != product.company_id.currency_id.id:
|
||||
if product.company_id and so_pricelist.currency_id.id != product.company_id.currency_id.id:
|
||||
# new_list_price is in company's currency while price in pricelist currency
|
||||
new_list_price = self.pool['res.currency'].compute(cr, uid,
|
||||
product.company_id.currency_id.id, so_pricelist.currency_id.id,
|
||||
|
@ -94,4 +94,6 @@ class sale_order_line(osv.osv):
|
|||
result['discount'] = 0.0
|
||||
else:
|
||||
result['discount'] = 0.0
|
||||
else:
|
||||
result['discount'] = 0.0
|
||||
return res
|
||||
|
|
Loading…
Reference in New Issue