Merge pull request #40035 from GursheenK/delete-ple-on-deletion-of-transactions

fix: delete PLE containing invoice in against
This commit is contained in:
Gursheen Kaur Anand 2024-02-23 12:36:14 +05:30 committed by GitHub
commit 3294282880
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -346,6 +346,12 @@ class AccountsController(TransactionBase):
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.delinked
== 1
)
).run()
frappe.db.sql(
"delete from `tabGL Entry` where voucher_type=%s and voucher_no=%s", (self.doctype, self.name)