Merge pull request #44329 from khushi8112/incorrect-gl-entry-on-asset-sale
fix: incorrect GL entry on sale of fully depreciated asset
This commit is contained in:
@@ -916,13 +916,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"
|
||||||
|
self.is_fully_depreciated = 1
|
||||||
elif flt(value_after_depreciation) < flt(self.gross_purchase_amount):
|
elif flt(value_after_depreciation) < flt(self.gross_purchase_amount):
|
||||||
status = "Partially Depreciated"
|
status = "Partially Depreciated"
|
||||||
|
self.is_fully_depreciated = 0
|
||||||
elif self.docstatus == 2:
|
elif self.docstatus == 2:
|
||||||
status = "Cancelled"
|
status = "Cancelled"
|
||||||
return status
|
return status
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ def restore_asset(asset_name):
|
|||||||
|
|
||||||
|
|
||||||
def depreciate_asset(asset, date):
|
def depreciate_asset(asset, date):
|
||||||
if not asset.calculate_depreciation:
|
if not asset.calculate_depreciation or asset.is_fully_depreciated:
|
||||||
return
|
return
|
||||||
|
|
||||||
asset.flags.ignore_validate_update_after_submit = True
|
asset.flags.ignore_validate_update_after_submit = True
|
||||||
|
|||||||
Reference in New Issue
Block a user