[FIX] sale: no company
- Activate multi-company - In a SO, remove the company (the field is not mandatory) The currency rate computation crashes. The computation expects a company in order to compute the rate. If there is no company set, we set the rate to 1.0. It is worth stressing that if both multi-company and multi-currency are activated, a company is necessary for reporting consistency. Fixes #34066 opw-2009044 closes odoo/odoo#34120 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -217,6 +217,8 @@ class SaleOrder(models.Model):
|
|||||||
@api.depends('pricelist_id', 'date_order', 'company_id')
|
@api.depends('pricelist_id', 'date_order', 'company_id')
|
||||||
def _compute_currency_rate(self):
|
def _compute_currency_rate(self):
|
||||||
for order in self:
|
for order in self:
|
||||||
|
if not order.company_id:
|
||||||
|
order.currency_rate = 1.0
|
||||||
order.currency_rate = self.env['res.currency']._get_conversion_rate(order.company_id.currency_id, order.currency_id, order.company_id, order.date_order)
|
order.currency_rate = self.env['res.currency']._get_conversion_rate(order.company_id.currency_id, order.currency_id, order.company_id, order.date_order)
|
||||||
|
|
||||||
def _compute_access_url(self):
|
def _compute_access_url(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user