[FIX] account: payment term discount affecting fixed tax
In Settings>Accounting set 'Cash Discount Tax Reduction' to 'Always' Have a payment term 'D' with discount Have a fixed tax 'F' Create an invoice with paymen term 'D', and 'F' on a line Issue: Tax amount will be affected by the discount, this should not occur for fixed taxes opw-3119894 X-original-commit: e18292d0079ab83673e3b5b406ebee9b5929f06d Part-of: odoo/odoo#110078
This commit is contained in:
@@ -1006,12 +1006,13 @@ class AccountMoveLine(models.Model):
|
||||
for percentages in percentages_to_apply:
|
||||
percentage = percentages['discount_percentage'] / 100
|
||||
line_percentage = percentages['term_percentage']
|
||||
taxes = line.tax_ids.filtered(lambda t: t.amount_type != 'fixed')
|
||||
epd_needed_vals = epd_needed.setdefault(
|
||||
frozendict({
|
||||
'move_id': line.move_id.id,
|
||||
'account_id': line.account_id.id,
|
||||
'analytic_distribution': line.analytic_distribution,
|
||||
'tax_ids': [Command.set(line.tax_ids.ids)],
|
||||
'tax_ids': [Command.set(taxes.ids)],
|
||||
'tax_tag_ids': [Command.set(line.tax_tag_ids.ids)],
|
||||
'display_type': 'epd',
|
||||
}),
|
||||
|
||||
@@ -60,6 +60,42 @@ class TestAccountEarlyPaymentDiscount(AccountTestInvoicingCommon):
|
||||
fields.Date.from_string('2019-01-11') or False
|
||||
)
|
||||
|
||||
# ========================== Tests Taxes Amounts =============================
|
||||
def test_fixed_tax_amount_discounted_payment_mixed(self):
|
||||
self.env.company.early_pay_discount_computation = 'mixed'
|
||||
fixed_tax = self.env['account.tax'].create({
|
||||
'name': 'Test 0.05',
|
||||
'amount_type': 'fixed',
|
||||
'amount': 0.05,
|
||||
})
|
||||
|
||||
invoice = self.env['account.move'].create({
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': self.partner_a.id,
|
||||
'invoice_date': '2019-01-01',
|
||||
'date': '2019-01-01',
|
||||
'invoice_line_ids': [Command.create({
|
||||
'name': 'line',
|
||||
'price_unit': 1000.0,
|
||||
'tax_ids': [Command.set(self.product_a.taxes_id.ids + fixed_tax.ids)],
|
||||
})],
|
||||
'invoice_payment_term_id': self.early_pay_mixed_5_10.id,
|
||||
})
|
||||
self.assertInvoiceValues(invoice, [
|
||||
# pylint: disable=bad-whitespace
|
||||
{'display_type': 'epd', 'balance': -75.0},
|
||||
{'display_type': 'epd', 'balance': 75.0},
|
||||
{'display_type': 'product', 'balance': -1000.0},
|
||||
{'display_type': 'tax', 'balance': -138.75},
|
||||
{'display_type': 'tax', 'balance': -0.05},
|
||||
{'display_type': 'payment_term', 'balance': 569.4},
|
||||
{'display_type': 'payment_term', 'balance': 569.4},
|
||||
], {
|
||||
'amount_untaxed': 1000.0,
|
||||
'amount_tax': 138.8,
|
||||
'amount_total': 1138.8,
|
||||
})
|
||||
|
||||
# ========================== Tests Payment Register ==========================
|
||||
def test_register_discounted_payment_on_single_invoice(self):
|
||||
self.company_data['company'].early_pay_discount_computation = 'included'
|
||||
|
||||
Reference in New Issue
Block a user