Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed asset value in Fixed Asset Register #41930

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ def get_data(filters):
if assets_linked_to_fb and asset.calculate_depreciation and asset.asset_id not in assets_linked_to_fb:
continue

asset_value = get_asset_value_after_depreciation(
asset.asset_id, finance_book
) or get_asset_value_after_depreciation(asset.asset_id)
depreciation_amount = depreciation_amount_map.get(asset.asset_id) or 0.0
asset_value = (
asset.gross_purchase_amount - asset.opening_accumulated_depreciation - depreciation_amount
)

row = {
"asset_id": asset.asset_id,
Expand All @@ -139,7 +140,7 @@ def get_data(filters):
or pi_supplier_map.get(asset.purchase_invoice),
"gross_purchase_amount": asset.gross_purchase_amount,
"opening_accumulated_depreciation": asset.opening_accumulated_depreciation,
"depreciated_amount": depreciation_amount_map.get(asset.asset_id) or 0.0,
"depreciated_amount": depreciation_amount,
"available_for_use_date": asset.available_for_use_date,
"location": asset.location,
"asset_category": asset.asset_category,
Expand Down Expand Up @@ -185,11 +186,12 @@ def prepare_chart_data(data, filters):
)

for d in data:
date = d.get(date_field)
belongs_to_month = formatdate(date, "MMM YYYY")
if d.get(date_field):
date = d.get(date_field)
belongs_to_month = formatdate(date, "MMM YYYY")

labels_values_map[belongs_to_month].asset_value += d.get("asset_value")
labels_values_map[belongs_to_month].depreciated_amount += d.get("depreciated_amount")
labels_values_map[belongs_to_month].asset_value += d.get("asset_value")
labels_values_map[belongs_to_month].depreciated_amount += d.get("depreciated_amount")

return {
"data": {
Expand Down
Loading