[FIX] event_sale: no company on SO

Do not crash at currency conversion when no company is set.

closes odoo/odoo#34155

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-06-14 15:36:14 +00:00
parent 94dc2fe5f7
commit 0c302e30a0
+3 -1
View File
@@ -83,7 +83,9 @@ class SaleOrderLine(models.Model):
company = self.event_id.company_id or self.env.user.company_id
currency = company.currency_id or self.env.user.company_id.currency_id
self.price_unit = currency._convert(
self.event_ticket_id.price, self.order_id.currency_id, self.order_id.company_id, self.order_id.date_order or fields.Date.today())
self.event_ticket_id.price, self.order_id.currency_id,
self.order_id.company_id or self.env.user.company_id,
self.order_id.date_order or fields.Date.today())
# we call this to force update the default name
self.product_id_change()