[FIX] event_sale: no currency

If the company is not set on the SO, the creation of a SO line crashes
because `currency` is empty.

opw-2005143

closes odoo/odoo#33783

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-05-31 06:36:55 +00:00
parent 5fccb75fde
commit d92acc602c
+1 -1
View File
@@ -81,7 +81,7 @@ class SaleOrderLine(models.Model):
@api.onchange('event_ticket_id')
def _onchange_event_ticket_id(self):
company = self.event_id.company_id or self.env.user.company_id
currency = company.currency_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())