mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
fix: Fix depreciation_amount calculation
This commit is contained in:
@@ -183,13 +183,12 @@ class Asset(AccountsController):
|
|||||||
start = 0
|
start = 0
|
||||||
for n in range (len(self.schedules)):
|
for n in range (len(self.schedules)):
|
||||||
if not self.schedules[n].journal_entry:
|
if not self.schedules[n].journal_entry:
|
||||||
print("*"*100)
|
|
||||||
del self.schedules[n:]
|
del self.schedules[n:]
|
||||||
start = n
|
start = n
|
||||||
break
|
break
|
||||||
|
|
||||||
value_after_depreciation = (flt(self.gross_purchase_amount) -
|
value_after_depreciation = (flt(self.asset_value) -
|
||||||
flt(self.opening_accumulated_depreciation))
|
flt(self.opening_accumulated_depreciation)) - flt(d.expected_value_after_useful_life)
|
||||||
|
|
||||||
d.value_after_depreciation = value_after_depreciation
|
d.value_after_depreciation = value_after_depreciation
|
||||||
|
|
||||||
@@ -779,8 +778,12 @@ def get_depreciation_amount(asset, depreciable_value, row):
|
|||||||
depreciation_left = flt(row.total_number_of_depreciations) - flt(asset.number_of_depreciations_booked)
|
depreciation_left = flt(row.total_number_of_depreciations) - flt(asset.number_of_depreciations_booked)
|
||||||
|
|
||||||
if row.depreciation_method in ("Straight Line", "Manual"):
|
if row.depreciation_method in ("Straight Line", "Manual"):
|
||||||
depreciation_amount = (flt(row.value_after_depreciation) -
|
if not asset.to_date:
|
||||||
flt(row.expected_value_after_useful_life)) / depreciation_left
|
depreciation_amount = (flt(row.value_after_depreciation) -
|
||||||
|
flt(row.expected_value_after_useful_life)) / depreciation_left
|
||||||
|
else:
|
||||||
|
depreciation_amount = (flt(row.value_after_depreciation) -
|
||||||
|
flt(row.expected_value_after_useful_life)) / (date_diff(asset.to_date, asset.available_for_use_date) / 365)
|
||||||
else:
|
else:
|
||||||
depreciation_amount = flt(depreciable_value * (flt(row.rate_of_depreciation) / 100))
|
depreciation_amount = flt(depreciable_value * (flt(row.rate_of_depreciation) / 100))
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,6 @@ class AssetRepair(Document):
|
|||||||
extra_months = self.increase_in_asset_life % row.frequency_of_depreciation
|
extra_months = self.increase_in_asset_life % row.frequency_of_depreciation
|
||||||
if extra_months != 0:
|
if extra_months != 0:
|
||||||
self.calculate_last_schedule_date(asset, row, extra_months)
|
self.calculate_last_schedule_date(asset, row, extra_months)
|
||||||
# fix depreciation amount
|
|
||||||
|
|
||||||
asset.prepare_depreciation_data()
|
asset.prepare_depreciation_data()
|
||||||
asset.save()
|
asset.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user