fix: check and update depreciation if depreciation method was changed

This commit is contained in:
khushi8112
2025-12-17 17:03:24 +05:30
parent 028b6790cf
commit aa8e8da29f

View File

@@ -187,13 +187,15 @@ class Asset(AccountsController):
def has_depreciation_settings_changed(self, schedule_doc, fb_row):
"""Check if depreciation calculation settings have changed"""
# For non-manual depreciation methods, always check for changes
if schedule_doc.depreciation_method != "Manual":
if not schedule_doc.get("depreciation_schedule"):
return True
if fb_row.depreciation_method != "Manual":
return True
# For manual depreciation, check specific parameters
return (
fb_row.total_number_of_depreciations != schedule_doc.total_number_of_depreciations
fb_row.depreciation_method != schedule_doc.depreciation_method
or fb_row.total_number_of_depreciations != schedule_doc.total_number_of_depreciations
or fb_row.frequency_of_depreciation != schedule_doc.frequency_of_depreciation
or getdate(fb_row.depreciation_start_date)
!= schedule_doc.get("depreciation_schedule")[0].schedule_date