From 22ac4deb9409441fd01d6c290548b0402641d458 Mon Sep 17 00:00:00 2001 From: Ravi Gohil Date: Tue, 14 Feb 2017 11:02:37 +0530 Subject: [PATCH] [FIX] account: crash if no default journal be set on invoice creation from PO When creating an invoice from Purchase Order(stat button) if you do not have a journal of type 'Purchase' defined for current user's company, it will crash. --- addons/account/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 7a2da204cd0..3801b9fc34f 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -74,7 +74,7 @@ class AccountInvoice(models.Model): @api.model def _default_currency(self): journal = self._default_journal() - return journal.currency_id or journal.company_id.currency_id + return journal.currency_id or journal.company_id.currency_id or self.env.user.company_id.currency_id @api.model def _get_reference_type(self):