mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-04 22:18:27 +00:00
fix: set asset status as fully depreciated (#52309)
* fix: set asset status as fully depreciated * test: test_is_fully_depreciated_asset_status * fix: remove unused condition
This commit is contained in:
@@ -792,13 +792,12 @@ class Asset(AccountsController):
|
||||
].expected_value_after_useful_life
|
||||
value_after_depreciation = self.finance_books[idx].value_after_depreciation
|
||||
|
||||
if (
|
||||
flt(value_after_depreciation) <= expected_value_after_useful_life
|
||||
or self.is_fully_depreciated
|
||||
):
|
||||
if flt(value_after_depreciation) <= expected_value_after_useful_life:
|
||||
status = "Fully Depreciated"
|
||||
elif flt(value_after_depreciation) < flt(self.net_purchase_amount):
|
||||
status = "Partially Depreciated"
|
||||
elif self.is_fully_depreciated:
|
||||
status = "Fully Depreciated"
|
||||
elif self.docstatus == 2:
|
||||
status = "Cancelled"
|
||||
return status
|
||||
|
||||
@@ -823,6 +823,12 @@ class TestAsset(AssetSetup):
|
||||
|
||||
frappe.db.set_value("Item", asset_item, "is_grouped_asset", 0)
|
||||
|
||||
def test_is_fully_depreciated_asset_status(self):
|
||||
asset = create_asset(item_code="Macbook Pro", do_not_save=1)
|
||||
asset.is_fully_depreciated = 1
|
||||
asset.save().submit()
|
||||
self.assertEqual(asset.status, "Fully Depreciated")
|
||||
|
||||
|
||||
class TestDepreciationMethods(AssetSetup):
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user