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

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

(cherry picked from commit 80230fec3ef079b75825447a61836f8a9ce64f57)

Co-authored-by: Anand Baburajan <anandbaburajan@gmail.com>
This commit is contained in:
mergify[bot] 2023-05-01 19:59:58 +05:30 committed by GitHub
parent ea0b03ae9e
commit 49674585a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,7 +150,9 @@ class AssetValueAdjustment(Document):
if d.depreciation_method in ("Straight Line", "Manual"): if d.depreciation_method in ("Straight Line", "Manual"):
end_date = max(s.schedule_date for s in depr_schedule) end_date = max(s.schedule_date for s in depr_schedule)
total_days = date_diff(end_date, self.date) 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 from_date = self.date
else: else:
no_of_depreciations = len([s.name for s in depr_schedule if not s.journal_entry]) no_of_depreciations = len([s.name for s in depr_schedule if not s.journal_entry])