From 70313df53178772624e2fa3525b7caff82e911c0 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 8 Sep 2022 18:53:30 +0530 Subject: [PATCH] fix: delete linked payment ledger entries no source doc deletion --- erpnext/controllers/accounts_controller.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index e689d567a1..28f281594e 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -205,6 +205,10 @@ class AccountsController(TransactionBase): 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) )