From c0402567935249e845c70d2e01a4509a97a70dcd Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 14 Oct 2021 12:34:03 +0530 Subject: [PATCH] fix: cannot add deductions in internal transfer payment entry (backport #27545) (#27930) * fix: cannot add deductions in internal transfer payment entry (cherry picked from commit 1b7414e948c89a86cd1d6bad3d0ec286440f00a5) # Conflicts: # erpnext/accounts/doctype/payment_entry/payment_entry.py * fix: Update message string (cherry picked from commit 3b9514d6e17bb9afab988e203268a3ac34356628) # Conflicts: # erpnext/accounts/doctype/payment_entry/payment_entry.py * fix: conflicts Co-authored-by: Saqib Ansari Co-authored-by: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Co-authored-by: Afshan <33727827+AfshanKhan@users.noreply.github.com> --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 8e799c7bccb..9b4a91d4e96 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -505,12 +505,13 @@ class PaymentEntry(AccountsController): def validate_received_amount(self): if self.paid_from_account_currency == self.paid_to_account_currency: - if self.paid_amount != self.received_amount: - frappe.throw(_("Received Amount should be same as Paid Amount")) + if self.paid_amount < self.received_amount: + frappe.throw(_("Received Amount cannot be greater than Paid Amount")) def set_received_amount(self): self.base_received_amount = self.base_paid_amount - if self.paid_from_account_currency == self.paid_to_account_currency: + if self.paid_from_account_currency == self.paid_to_account_currency \ + and not self.payment_type == 'Internal Transfer': self.received_amount = self.paid_amount def set_amounts_after_tax(self):