diff --git a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py index 7d08581cbe..a8f2d79c27 100644 --- a/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py +++ b/erpnext/assets/doctype/asset_capitalization/asset_capitalization.py @@ -371,6 +371,7 @@ class AssetCapitalization(StockController): self.set_consumed_asset_status(asset) if asset.calculate_depreciation: + self.reverse_depreciation_entry_made_after_disposal(asset) self.reset_depreciation_schedule(asset) else: if asset.calculate_depreciation: diff --git a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py index 5a342f7d2f..7046de6f83 100644 --- a/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py +++ b/erpnext/assets/doctype/asset_capitalization/test_asset_capitalization.py @@ -174,6 +174,7 @@ class TestAssetCapitalization(unittest.TestCase): self.assertEqual(actual_gle, expected_gle) # Cancel Asset Capitalization and make test entries and status are reversed + asset_capitalization.reload() asset_capitalization.cancel() self.assertEqual(consumed_asset.db_get('status'), 'Partially Depreciated') self.assertFalse(get_actual_gle_dict(asset_capitalization.name))