Skip to content

Commit

Permalink
fix: don't depreciate assets with no schedule on scrapping (#38276)
Browse files Browse the repository at this point in the history
fix: don't depreciate non-depreciable assets on scrapping
  • Loading branch information
anandbaburajan authored Nov 23, 2023
1 parent c99c805 commit 816b1b6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions erpnext/assets/doctype/asset/depreciation.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,9 @@ def restore_asset(asset_name):


def depreciate_asset(asset_doc, date, notes):
if not asset_doc.calculate_depreciation:
return

asset_doc.flags.ignore_validate_update_after_submit = True

make_new_active_asset_depr_schedules_and_cancel_current_ones(
Expand All @@ -521,6 +524,9 @@ def depreciate_asset(asset_doc, date, notes):


def reset_depreciation_schedule(asset_doc, date, notes):
if not asset_doc.calculate_depreciation:
return

asset_doc.flags.ignore_validate_update_after_submit = True

make_new_active_asset_depr_schedules_and_cancel_current_ones(
Expand Down

0 comments on commit 816b1b6

Please sign in to comment.