From 1a7d4ec378ac9bc34ceb126cf39379a761adb136 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 29 Jul 2019 15:20:48 +0000 Subject: [PATCH] [FIX] account: invoice default tax separate purch/sale Unset the default sale tax on the company Make a customer invoice Add a line Before this commit, the tax on the line was the purchase tax because of a funky "if" After this commit, no tax is set on the line It is worth noting that archiving taxes shouldn't affect this flow as it is the user's reponsibility to di his set up correctly OPW 2043477 closes odoo/odoo#35271 Signed-off-by: Lucas Perais (lpe) --- addons/account/models/account_invoice.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 14075ff0c0d..1d4eaa76d59 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1849,7 +1849,10 @@ class AccountInvoiceLine(models.Model): return if not self.product_id: fpos = self.invoice_id.fiscal_position_id - default_tax = self.invoice_id.type in ('out_invoice', 'out_refund') and self.invoice_id.company_id.account_sale_tax_id or self.invoice_id.company_id.account_purchase_tax_id + if self.invoice_id.type in ('out_invoice', 'out_refund'): + default_tax = self.invoice_id.company_id.account_sale_tax_id + else: + default_tax = self.invoice_id.company_id.account_purchase_tax_id self.invoice_line_tax_ids = fpos.map_tax(self.account_id.tax_ids or default_tax, partner=self.partner_id).ids elif not self.price_unit: self._set_taxes()