fix: missing attribute error when restoring asset

This commit is contained in:
khushi8112
2025-12-09 15:10:16 +05:30
parent 1637cb4168
commit bde209b077

View File

@@ -530,6 +530,7 @@ def reset_depreciation_schedule(asset_doc, date, notes):
def modify_depreciation_schedule_for_asset_repairs(asset, notes): def modify_depreciation_schedule_for_asset_repairs(asset, notes):
# test
asset_repairs = frappe.get_all( asset_repairs = frappe.get_all(
"Asset Repair", filters={"asset": asset.name}, fields=["name", "increase_in_asset_life"] "Asset Repair", filters={"asset": asset.name}, fields=["name", "increase_in_asset_life"]
) )
@@ -537,6 +538,7 @@ def modify_depreciation_schedule_for_asset_repairs(asset, notes):
for repair in asset_repairs: for repair in asset_repairs:
if repair.increase_in_asset_life: if repair.increase_in_asset_life:
asset_repair = frappe.get_doc("Asset Repair", repair.name) asset_repair = frappe.get_doc("Asset Repair", repair.name)
asset_repair.asset_doc = asset
asset_repair.modify_depreciation_schedule() asset_repair.modify_depreciation_schedule()
make_new_active_asset_depr_schedules_and_cancel_current_ones(asset, notes) make_new_active_asset_depr_schedules_and_cancel_current_ones(asset, notes)