From 946641da550582ef73bfd6e28c105b23cb388ca1 Mon Sep 17 00:00:00 2001 From: wan Date: Wed, 10 Apr 2019 12:20:19 +0000 Subject: [PATCH] [FIX] account: import of invoice by csv gave wrong account Task 1961719 type was set to False when called in the create method. This yielded always the same account when importing invoices. Getting the value of type from the context corrects that issue. closes odoo/odoo#32579 Signed-off-by: Quentin De Paoli (qdp) --- addons/account/models/account_invoice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 97d94065137..d7d980728fd 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -792,7 +792,7 @@ class AccountInvoice(models.Model): domain = {} company_id = self.company_id.id p = self.partner_id if not company_id else self.partner_id.with_context(force_company=company_id) - type = self.type + type = self.type or self.env.context.get('type', 'out_invoice') if p: rec_account = p.property_account_receivable_id pay_account = p.property_account_payable_id @@ -1785,7 +1785,7 @@ class AccountInvoiceLine(models.Model): self_lang = self if part.lang: self_lang = self.with_context(lang=part.lang) - + product = self_lang.product_id account = self.get_invoice_line_account(type, product, fpos, company) if account: