From cdb0dae247335a12432ce1052d99a60f83f5a1ab Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Tue, 24 Nov 2015 09:42:25 +0100 Subject: [PATCH] [FIX] account: default value for journal_id not correctly working when clicking from dashboard missing journal_id in search view and default value for journal_id when creating a new invoice should first take value in context if any. --- addons/account/models/account_invoice.py | 2 ++ addons/account/views/account_invoice_view.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 776b1ea959f..6163bdbfc90 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -56,6 +56,8 @@ class AccountInvoice(models.Model): @api.model def _default_journal(self): + if self._context.get('default_journal_id', False): + return self.env['account.journal'].browse(self._context.get('default_journal_id')) inv_type = self._context.get('type', 'out_invoice') inv_types = inv_type if isinstance(inv_type, list) else [inv_type] company_id = self._context.get('company_id', self.env.user.company_id.id) diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml index deb16e0e958..24eeaaa5288 100644 --- a/addons/account/views/account_invoice_view.xml +++ b/addons/account/views/account_invoice_view.xml @@ -502,6 +502,7 @@ +