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:
Khushi Rawat
2024-11-27 01:09:33 +05:30
committed by GitHub
2 changed files with 4 additions and 5 deletions

View File

@@ -916,13 +916,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"
self.is_fully_depreciated = 1
elif flt(value_after_depreciation) < flt(self.gross_purchase_amount):
status = "Partially Depreciated"
self.is_fully_depreciated = 0
elif self.docstatus == 2:
status = "Cancelled"
return status

View File

@@ -454,7 +454,7 @@ def restore_asset(asset_name):
def depreciate_asset(asset, date):
if not asset.calculate_depreciation:
if not asset.calculate_depreciation or asset.is_fully_depreciated:
return
asset.flags.ignore_validate_update_after_submit = True