Skip to content

Commit

Permalink
fix: only check for delinked PLEs
Browse files Browse the repository at this point in the history
(cherry picked from commit 146c5b3)
  • Loading branch information
GursheenK authored and mergify[bot] committed Feb 23, 2024
1 parent 190bd45 commit a75a69a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,12 @@ def on_trash(self):
ple = frappe.qb.DocType("Payment Ledger Entry")
frappe.qb.from_(ple).delete().where(
(ple.voucher_type == self.doctype) & (ple.voucher_no == self.name)
| ((ple.against_voucher_type == self.doctype) & (ple.against_voucher_no == self.name))
| (
(ple.against_voucher_type == self.doctype)
& (ple.against_voucher_no == self.name)
& ple.delinked
== 1
)
).run()
frappe.db.sql(
"delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s", (self.doctype, self.name)
Expand Down

0 comments on commit a75a69a

Please sign in to comment.