mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
fix: salvage value after value adjustment
This commit is contained in:
@@ -180,13 +180,22 @@ class AssetValueAdjustment(Document):
|
|||||||
if asset.calculate_depreciation:
|
if asset.calculate_depreciation:
|
||||||
for row in asset.finance_books:
|
for row in asset.finance_books:
|
||||||
if cstr(row.finance_book) == cstr(self.finance_book):
|
if cstr(row.finance_book) == cstr(self.finance_book):
|
||||||
row.value_after_depreciation += flt(difference_amount)
|
salvage_value_adjustment = (
|
||||||
|
self.get_adjusted_salvage_value_amount(row, difference_amount) or 0
|
||||||
|
)
|
||||||
|
row.expected_value_after_useful_life += salvage_value_adjustment
|
||||||
|
row.value_after_depreciation = row.value_after_depreciation + flt(difference_amount)
|
||||||
row.db_update()
|
row.db_update()
|
||||||
|
|
||||||
asset.value_after_depreciation += flt(difference_amount)
|
asset.value_after_depreciation += flt(difference_amount)
|
||||||
asset.db_update()
|
asset.db_update()
|
||||||
return asset
|
return asset
|
||||||
|
|
||||||
|
def get_adjusted_salvage_value_amount(self, row, difference_amount):
|
||||||
|
if row.expected_value_after_useful_life:
|
||||||
|
salvage_value_adjustment = (difference_amount * row.salvage_value_percentage) / 100
|
||||||
|
return flt(salvage_value_adjustment)
|
||||||
|
|
||||||
def get_adjustment_note(self):
|
def get_adjustment_note(self):
|
||||||
if self.docstatus == 1:
|
if self.docstatus == 1:
|
||||||
notes = _(
|
notes = _(
|
||||||
|
|||||||
Reference in New Issue
Block a user