Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't depreciate assets with no schedule on scrapping #38276

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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