[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) <lpe@odoo.com>
This commit is contained in:
Lucas Perais (lpe)
2019-07-29 15:20:48 +00:00
parent 1aaf1da72c
commit 1a7d4ec378
+4 -1
View File
@@ -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()