mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 05:09:11 +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
|
].expected_value_after_useful_life
|
||||||
value_after_depreciation = self.finance_books[idx].value_after_depreciation
|
value_after_depreciation = self.finance_books[idx].value_after_depreciation
|
||||||
|
|
||||||
if (
|
if flt(value_after_depreciation) <= expected_value_after_useful_life:
|
||||||
flt(value_after_depreciation) <= expected_value_after_useful_life
|
|
||||||
or self.is_fully_depreciated
|
|
||||||
):
|
|
||||||
status = "Fully Depreciated"
|
status = "Fully Depreciated"
|
||||||
elif flt(value_after_depreciation) < flt(self.net_purchase_amount):
|
elif flt(value_after_depreciation) < flt(self.net_purchase_amount):
|
||||||
status = "Partially Depreciated"
|
status = "Partially Depreciated"
|
||||||
|
elif self.is_fully_depreciated:
|
||||||
|
status = "Fully Depreciated"
|
||||||
elif self.docstatus == 2:
|
elif self.docstatus == 2:
|
||||||
status = "Cancelled"
|
status = "Cancelled"
|
||||||
return status
|
return status
|
||||||
|
|||||||
@@ -823,6 +823,12 @@ class TestAsset(AssetSetup):
|
|||||||
|
|
||||||
frappe.db.set_value("Item", asset_item, "is_grouped_asset", 0)
|
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):
|
class TestDepreciationMethods(AssetSetup):
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user