diff --git a/addons/account/models/account_move_line.py b/addons/account/models/account_move_line.py index 24fc922bb1e..9e2f29ddf3e 100644 --- a/addons/account/models/account_move_line.py +++ b/addons/account/models/account_move_line.py @@ -843,7 +843,7 @@ class AccountMoveLine(models.Model): @api.depends('product_id', 'product_uom_id') def _compute_tax_ids(self): for line in self: - if line.display_type in ('line_section', 'line_note'): + if line.display_type in ('line_section', 'line_note', 'payment_term'): continue # /!\ Don't remove existing taxes if there is no explicit taxes set on the account. if line.product_id or line.account_id.tax_ids or not line.tax_ids: diff --git a/addons/account/tests/test_account_move_out_invoice.py b/addons/account/tests/test_account_move_out_invoice.py index 2963379b782..b32dd0232e8 100644 --- a/addons/account/tests/test_account_move_out_invoice.py +++ b/addons/account/tests/test_account_move_out_invoice.py @@ -3647,3 +3647,25 @@ class TestAccountMoveOutInvoiceOnchanges(AccountTestInvoicingCommon): self.assertEqual(invalid_invoice_2.state, 'draft') self.assertEqual(invalid_invoice_2.message_ids[0].body, "
The move could not be posted for the following reason: You need to add a line before posting.
") + + def test_no_taxes_on_payment_term_line(self): + ''' No tax should be set on payment_term lines''' + + receivable_account = self.partner_a.property_account_receivable_id + receivable_account.tax_ids = [Command.set(self.company_data['default_tax_sale'].ids)] + + invoice = self.env['account.move'].create({ + 'move_type': 'out_invoice', + 'partner_id': self.partner_a.id, + 'invoice_line_ids': [ + Command.create({ + 'name': 'test line', + 'quantity': 1, + 'price_unit': 100, + }) + ], + }) + + self.assertRecordValues(invoice.line_ids.filtered(lambda l: l.display_type == 'payment_term'), [ + {'account_id': receivable_account.id, 'tax_ids': []}, + ])