fix(Fixed Asset Register): error when selecting more than one fiscal year
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 faffd11..d41069c 100644
--- a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
+++ b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
@@ -126,16 +126,18 @@
if not asset.calculate_depreciation:
return flt(asset.gross_purchase_amount) - flt(asset.opening_accumulated_depreciation)
- finance_book_filter = ["finance_book", "is", "not set"]
- if finance_book:
- finance_book_filter = ["finance_book", "=", finance_book]
-
- return frappe.db.get_value(
+ result = frappe.get_all(
doctype="Asset Finance Book",
- filters=[["parent", "=", asset.asset_id], finance_book_filter],
- fieldname="value_after_depreciation",
+ filters={
+ "parent": asset.asset_id,
+ "finance_book": finance_book or ("is", "not set"),
+ },
+ pluck="value_after_depreciation",
+ limit=1,
)
+ return result[0] if result else 0.0
+
def prepare_chart_data(data, filters):
labels_values_map = {}