mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-13 22:51:49 +00:00
fix: tax.base_tax_amount as none when payment entry created using API
(cherry picked from commit b9b402f2ec)
This commit is contained in:
@@ -1197,9 +1197,9 @@ class PaymentEntry(AccountsController):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if tax.add_deduct_tax == "Add":
|
if tax.add_deduct_tax == "Add":
|
||||||
included_taxes += tax.base_tax_amount
|
included_taxes += flt(tax.base_tax_amount)
|
||||||
else:
|
else:
|
||||||
included_taxes -= tax.base_tax_amount
|
included_taxes -= flt(tax.base_tax_amount)
|
||||||
|
|
||||||
return included_taxes
|
return included_taxes
|
||||||
|
|
||||||
|
|||||||
@@ -1118,6 +1118,27 @@ class TestPaymentEntry(FrappeTestCase):
|
|||||||
|
|
||||||
self.assertEqual(gl_entries, expected_gl_entries)
|
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):
|
def test_payment_entry_against_onhold_purchase_invoice(self):
|
||||||
pi = make_purchase_invoice()
|
pi = make_purchase_invoice()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user