diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 4b457abe2d4..4d218d272b3 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1206,9 +1206,9 @@ class PaymentEntry(AccountsController): continue if tax.add_deduct_tax == "Add": - included_taxes += tax.base_tax_amount + included_taxes += flt(tax.base_tax_amount) else: - included_taxes -= tax.base_tax_amount + included_taxes -= flt(tax.base_tax_amount) return included_taxes diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py index 90bba1f40d7..71b74d27986 100644 --- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py @@ -1113,6 +1113,27 @@ class TestPaymentEntry(ERPNextTestSuite): self.assertEqual(gl_entries, expected_gl_entries) + def test_payment_entry_with_inclusive_tax(self): + # inclusive tax built server-side: base_tax_amount is None until apply_taxes() + payment_entry = create_payment_entry(paid_amount=1180) + payment_entry.append( + "taxes", + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Paid Amount", + "rate": 18, + "included_in_paid_amount": 1, + "add_deduct_tax": "Add", + "description": "Service Tax", + }, + ) + payment_entry.save() + payment_entry.submit() + + # 1180 incl 18% => 1000 base + 180 tax + self.assertEqual(flt(payment_entry.total_taxes_and_charges, 2), 180.0) + self.assertEqual(flt(payment_entry.unallocated_amount, 2), 1000.0) + def test_payment_entry_against_onhold_purchase_invoice(self): pi = make_purchase_invoice()