perf(asset): fetch only distinct depreciable assets (#30138)

(cherry picked from commit 66f20209f6)

Co-authored-by: Saqib Ansari <nextchamp.saqib@gmail.com>
This commit is contained in:
mergify[bot]
2022-03-09 17:48:49 +05:30
committed by GitHub
parent db38c36bba
commit 63e7d8c651

View File

@@ -23,7 +23,7 @@ def post_depreciation_entries(date=None):
frappe.db.commit()
def get_depreciable_assets(date):
return frappe.db.sql_list("""select a.name
return frappe.db.sql_list("""select distinct a.name
from tabAsset a, `tabDepreciation Schedule` ds
where a.name = ds.parent and a.docstatus=1 and ds.schedule_date<=%s and a.calculate_depreciation = 1
and a.status in ('Submitted', 'Partially Depreciated')