Merge pull request #33888 from barredterra/get-asset-value
fix(Fixed Asset Register): error when selecting more than one fiscal …
This commit is contained in:
commit
e007776ada
@ -126,16 +126,18 @@ def get_asset_value(asset, finance_book=None):
|
||||
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 = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user