From 0a17c78a363e81be5b7e5bfd55f93ade122c176c Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Tue, 4 Jul 2023 17:49:07 +0530 Subject: [PATCH] fix: Share ledger showing cancelled docs (#35993) --- erpnext/accounts/report/share_ledger/share_ledger.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/share_ledger/share_ledger.py b/erpnext/accounts/report/share_ledger/share_ledger.py index d6c3bd059f..629528e5cc 100644 --- a/erpnext/accounts/report/share_ledger/share_ledger.py +++ b/erpnext/accounts/report/share_ledger/share_ledger.py @@ -67,8 +67,9 @@ def get_all_transfers(date, shareholder): # condition = 'AND company = %(company)s ' return frappe.db.sql( """SELECT * FROM `tabShare Transfer` - WHERE (DATE(date) <= %(date)s AND from_shareholder = %(shareholder)s {condition}) - OR (DATE(date) <= %(date)s AND to_shareholder = %(shareholder)s {condition}) + WHERE ((DATE(date) <= %(date)s AND from_shareholder = %(shareholder)s {condition}) + OR (DATE(date) <= %(date)s AND to_shareholder = %(shareholder)s {condition})) + AND docstatus = 1 ORDER BY date""".format( condition=condition ),