[FIX] product_visible_discount: product without company_id
When computing the real price of a product, a currency of reference is needed, first the currency of the product's company is privileged and if no company is set on the product then the currency of the user's company is taken. opw:678159
This commit is contained in:
@@ -33,14 +33,15 @@ class sale_order_line(osv.osv):
|
||||
currency_id = item.pricelist_id.currency_id
|
||||
|
||||
product = product_obj.browse(cr, uid, product_id, context=context)
|
||||
product_currency = (product.company_id and product.company_id.currency_id) or self.pool['res.users'].browse(cr, uid, uid).company_id.currency_id
|
||||
if not currency_id:
|
||||
currency_id = product.company_id.currency_id
|
||||
currency_id = product_currency
|
||||
cur_factor = 1.0
|
||||
else:
|
||||
if currency_id.id == product.company_id.currency_id.id:
|
||||
if currency_id.id == product_currency.id:
|
||||
cur_factor = 1.0
|
||||
else:
|
||||
cur_factor = self.pool['res.currency']._get_conversion_rate(cr, uid, product.company_id.currency_id, currency_id, context=context)
|
||||
cur_factor = self.pool['res.currency']._get_conversion_rate(cr, uid, product_currency, currency_id, context=context)
|
||||
|
||||
product_uom = context and context.get('uom') or product.uom_id.id
|
||||
if uom and uom != product_uom:
|
||||
|
||||
Reference in New Issue
Block a user