Skip to content

Commit

Permalink
fix: delete linked payment ledger entries no source doc deletion
Browse files Browse the repository at this point in the history
(cherry picked from commit 70313df)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Sep 11, 2022
1 parent 793ee83 commit ccd0449
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ def before_cancel(self):
def on_trash(self):
# delete sl and gl entries on deletion of transaction
if frappe.db.get_single_value("Accounts Settings", "delete_linked_ledger_entries"):
ple = frappe.qb.DocType("Payment Ledger Entry")
frappe.qb.from_(ple).delete().where(
(ple.voucher_type == self.doctype) & (ple.voucher_no == self.name)
).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 ccd0449

Please sign in to comment.