mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-14 04:15:10 +00:00
fix: depreciate asset with remaining amount when depreciation amount exceeds current asset value
This commit is contained in:
@@ -369,6 +369,10 @@ class AssetDepreciationSchedule(Document):
|
|||||||
original_schedule_date=schedule_date,
|
original_schedule_date=schedule_date,
|
||||||
)
|
)
|
||||||
depreciation_amount = flt(depreciation_amount, asset_doc.precision("gross_purchase_amount"))
|
depreciation_amount = flt(depreciation_amount, asset_doc.precision("gross_purchase_amount"))
|
||||||
|
|
||||||
|
if depreciation_amount > row.value_after_depreciation - row.expected_value_after_useful_life:
|
||||||
|
depreciation_amount = row.value_after_depreciation - row.expected_value_after_useful_life
|
||||||
|
|
||||||
if depreciation_amount > 0:
|
if depreciation_amount > 0:
|
||||||
self.add_depr_schedule_row(date_of_disposal, depreciation_amount, n)
|
self.add_depr_schedule_row(date_of_disposal, depreciation_amount, n)
|
||||||
|
|
||||||
@@ -654,6 +658,7 @@ def _get_pro_rata_amt(
|
|||||||
total_days = get_total_days(original_schedule_date or to_date, 12)
|
total_days = get_total_days(original_schedule_date or to_date, 12)
|
||||||
else:
|
else:
|
||||||
total_days = get_total_days(original_schedule_date or to_date, row.frequency_of_depreciation)
|
total_days = get_total_days(original_schedule_date or to_date, row.frequency_of_depreciation)
|
||||||
|
print(total_days, days, depreciation_amount)
|
||||||
return (depreciation_amount * flt(days)) / flt(total_days), days, months
|
return (depreciation_amount * flt(days)) / flt(total_days), days, months
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user