fix: list index out of range (#37890) * fix: list index out of range * fix: solve linter test failing (cherry picked from commit e5bc8fccb17d96df81e10d3b4b565b430c1b5374) Co-authored-by: viralkansodiya15 <98073516+viralpatel15@users.noreply.github.com>
This commit is contained in:
parent
7d0f1f4235
commit
e71ef10ca9
@ -780,6 +780,15 @@ def get_disposal_account_and_cost_center(company):
|
|||||||
def get_value_after_depreciation_on_disposal_date(asset, disposal_date, finance_book=None):
|
def get_value_after_depreciation_on_disposal_date(asset, disposal_date, finance_book=None):
|
||||||
asset_doc = frappe.get_doc("Asset", asset)
|
asset_doc = frappe.get_doc("Asset", asset)
|
||||||
|
|
||||||
|
if asset_doc.available_for_use_date > getdate(disposal_date):
|
||||||
|
frappe.throw(
|
||||||
|
"Disposal date {0} cannot be before available for use date {1} of the asset.".format(
|
||||||
|
disposal_date, asset_doc.available_for_use_date
|
||||||
|
)
|
||||||
|
)
|
||||||
|
elif asset_doc.available_for_use_date == getdate(disposal_date):
|
||||||
|
return flt(asset_doc.gross_purchase_amount - asset_doc.opening_accumulated_depreciation)
|
||||||
|
|
||||||
if not asset_doc.calculate_depreciation:
|
if not asset_doc.calculate_depreciation:
|
||||||
return flt(asset_doc.value_after_depreciation)
|
return flt(asset_doc.value_after_depreciation)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user