[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) <qdp@openerp.com>
This commit is contained in:
wan
2019-05-20 08:38:03 +00:00
parent 3845e0ff61
commit 946641da55
+2 -2
View File
@@ -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: