Optimization: don't update outstanding amount while cancelling payment entry for advance adjustment (#12689)
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index c575d59..03a06cc 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -191,8 +191,9 @@
for entry in gl_entries:
validate_frozen_account(entry["account"], adv_adj)
validate_balance_type(entry["account"], adv_adj)
- validate_expense_against_budget(entry)
+ if not adv_adj:
+ validate_expense_against_budget(entry)
- if entry.get("against_voucher") and update_outstanding == 'Yes':
+ if entry.get("against_voucher") and update_outstanding == 'Yes' and not adv_adj:
update_outstanding_amt(entry["account"], entry.get("party_type"), entry.get("party"), entry.get("against_voucher_type"),
entry.get("against_voucher"), on_cancel=True)