From 1fd73af744b33617517cb39a297eeca97e4250f4 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Fri, 9 Dec 2022 00:28:34 +0530 Subject: [PATCH] chore: refactor some reports --- .../asset_depreciations_and_balances.py | 4 ++-- .../report/fixed_asset_register/fixed_asset_register.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py b/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py index ad9b1ba58e..43b95dca80 100644 --- a/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py +++ b/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py @@ -131,8 +131,8 @@ def get_assets(filters): else 0 end), 0) as depreciation_amount_during_the_period - from `tabAsset` a, `tabDepreciation Schedule` ds - where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s and a.name = ds.parent and ifnull(ds.journal_entry, '') != '' + from `tabAsset` a, `tabAsset Depreciation Schedule` ads, `tabDepreciation Schedule` ds + where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s and ads.asset = a.name and ads.docstatus=1 and ads.name = ds.parent and ifnull(ds.journal_entry, '') != '' group by a.asset_category union SELECT a.asset_category, diff --git a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py index f45b40bded..bb50df0ba2 100644 --- a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py +++ b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py @@ -176,7 +176,7 @@ def get_finance_book_value_map(filters): return frappe._dict( frappe.db.sql( """ Select - ads.name, SUM(depreciation_amount) + ads.asset, SUM(depreciation_amount) FROM `tabAsset Depreciation Schedule` ads, `tabDepreciation Schedule` ds WHERE ds.parent = ads.name @@ -185,7 +185,7 @@ def get_finance_book_value_map(filters): AND ds.parentfield='depreciation_schedule' AND ds.schedule_date<=%s AND ds.journal_entry IS NOT NULL - GROUP BY ads.name""", + GROUP BY ads.asset""", (cstr(filters.finance_book or ""), date), ) )