Skip to content

Commit

Permalink
Merge pull request #39667 from frappe/mergify/bp/version-14-hotfix/pr…
Browse files Browse the repository at this point in the history
…-39655

fix: correctly calculate diff amount for included taxes (backport #39655)
  • Loading branch information
ruthra-kumar authored Feb 1, 2024
2 parents 49817ab + 350b2cd commit 76c652c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions erpnext/accounts/doctype/payment_entry/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,19 +874,19 @@ def set_difference_amount(self):
)

base_party_amount = flt(self.base_total_allocated_amount) + flt(base_unallocated_amount)
included_taxes = self.get_included_taxes()

if self.payment_type == "Receive":
self.difference_amount = base_party_amount - self.base_received_amount
self.difference_amount = base_party_amount - self.base_received_amount + included_taxes
elif self.payment_type == "Pay":
self.difference_amount = self.base_paid_amount - base_party_amount
self.difference_amount = self.base_paid_amount - base_party_amount - included_taxes
else:
self.difference_amount = self.base_paid_amount - flt(self.base_received_amount)
self.difference_amount = self.base_paid_amount - flt(self.base_received_amount) - included_taxes

total_deductions = sum(flt(d.amount) for d in self.get("deductions"))
included_taxes = self.get_included_taxes()

self.difference_amount = flt(
self.difference_amount - total_deductions - included_taxes, self.precision("difference_amount")
self.difference_amount - total_deductions, self.precision("difference_amount")
)

def get_included_taxes(self):
Expand Down

0 comments on commit 76c652c

Please sign in to comment.