chore: handle some cases where asset_depr_schedule doesn't exist

This commit is contained in:
anandbaburajan 2022-12-12 17:31:57 +05:30
parent b997d1eb87
commit 1ea2ba0dea

View File

@ -47,6 +47,9 @@ def update_draft_asset_depr_schedules(asset_doc, date_of_disposal=None, date_of_
for row in asset_doc.get("finance_books"):
asset_depr_schedule_doc = get_asset_depr_schedule_doc(asset_doc.name, row.finance_book)
if not asset_depr_schedule_doc:
continue
prepare_draft_asset_depr_schedule_data(
asset_depr_schedule_doc, asset_doc, row, date_of_disposal, date_of_return
)
@ -142,6 +145,9 @@ def get_asset_depr_schedule_name(asset_name, finance_book):
def get_depr_schedule(asset_name, finance_book):
asset_depr_schedule_doc = get_asset_depr_schedule_doc(asset_name, finance_book)
if not asset_depr_schedule_doc:
return
return asset_depr_schedule_doc.get("depreciation_schedule")