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
  • Loading branch information
ruthra-kumar committed Sep 8, 2022
1 parent 3c055f9 commit 1afa4d6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions erpnext/controllers/accounts_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ 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 1afa4d6

Please sign in to comment.