From 287b421fab9cbc16f415aa7ba107db1c3af43691 Mon Sep 17 00:00:00 2001 From: Gursheen Kaur Anand <40693548+GursheenK@users.noreply.github.com> Date: Thu, 1 Feb 2024 10:13:29 +0530 Subject: [PATCH] fix: correctly calculate diff amount for included taxes (#39655) --- .../accounts/doctype/payment_entry/payment_entry.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 9afe9c957af..2e564b802ef 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -772,7 +772,6 @@ class PaymentEntry(AccountsController): self.base_in_words = money_in_words(base_amount, self.company_currency) self.in_words = money_in_words(amount, currency) - def set_tax_withholding(self): if self.party_type != "Supplier": return @@ -1003,19 +1002,19 @@ class PaymentEntry(AccountsController): ) 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): -- GitLab