fix: handle expected_value_after_useful_life properly in asset value adjustment (backport #35117) (#35120)

fix: handle expected_value_after_useful_life properly in asset value adjustment (#35117)

(cherry picked from commit 80230fec3e)

Co-authored-by: Anand Baburajan <anandbaburajan@gmail.com>
This commit is contained in:
mergify[bot]
2023-05-01 20:00:04 +05:30
committed by GitHub
parent d3c769c183
commit 635559d905

View File

@@ -119,7 +119,9 @@ class AssetValueAdjustment(Document):
if d.depreciation_method in ("Straight Line", "Manual"):
end_date = max(s.schedule_date for s in asset.schedules if cint(s.finance_book_id) == d.idx)
total_days = date_diff(end_date, self.date)
rate_per_day = flt(d.value_after_depreciation) / flt(total_days)
rate_per_day = flt(d.value_after_depreciation - d.expected_value_after_useful_life) / flt(
total_days
)
from_date = self.date
else:
no_of_depreciations = len(