[FIX] sale: _get_conversion_rate called with no date
Steps to reproduce the bug: - Define two pricelists P1(€) the default one and P2($) with discount_policy = 'without_discount' - Activate P1 and P2 on the website - Go on the shop and select P2 Bug: An error was raised from function _get_conversion_rate because the arguments date and company_id were not defined because the function _get_real_price_currency was called from _website_product_id_change with the model "self.env['sale.order.line'] and not with a recordset. So the fields self.company_id and self.order_id.date_order were not defined. opw:1969849 closes odoo/odoo#32726 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
@@ -1578,7 +1578,7 @@ class SaleOrderLine(models.Model):
|
||||
if currency_id.id == product_currency.id:
|
||||
cur_factor = 1.0
|
||||
else:
|
||||
cur_factor = currency_id._get_conversion_rate(product_currency, currency_id, self.company_id, self.order_id.date_order)
|
||||
cur_factor = currency_id._get_conversion_rate(product_currency, currency_id, self.company_id or self.env.user.company_id, self.order_id.date_order or fields.Date.today())
|
||||
|
||||
product_uom = self.env.context.get('uom') or product.uom_id.id
|
||||
if uom and uom.id != product_uom:
|
||||
|
||||
Reference in New Issue
Block a user