From 64fd5288c89cebf1746fe0a98f3b9cd449d010ae Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 1 Dec 2014 15:28:00 +0100 Subject: [PATCH] [FIX] account: There is no sale_refund nor purchase_refund analytic journal During rev. cbe2dbb, type2journal was refactored, and set as a global variable in the top of the file, as it was use everywhere accross the file. But, in this specific method _get_journal_analytic, this type2journal dict wasn't the same as everywhere else, as you can see at rev. d2ff95f for example. We must therefore set a specific type2journal dict for this specific method. --- addons/account/account_invoice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 8195fd76f30..7b01459bea5 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -87,7 +87,8 @@ class account_invoice(models.Model): @api.returns('account.analytic.journal', lambda r: r.id) def _get_journal_analytic(self, inv_type): """ Return the analytic journal corresponding to the given invoice type. """ - journal_type = TYPE2JOURNAL.get(inv_type, 'sale') + type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale', 'in_refund': 'purchase'} + journal_type = type2journal.get(inv_type, 'sale') journal = self.env['account.analytic.journal'].search([('type', '=', journal_type)], limit=1) if not journal: raise except_orm(_('No Analytic Journal!'),