Skip to content

Commit

Permalink
Bug fix in Process reimburse handle (#515)
Browse files Browse the repository at this point in the history
* Handle Exception properly

* handle permission denied case

* Fix test

* Bug fix
  • Loading branch information
Ashutosh619-sudo committed Jun 26, 2024
1 parent 25220ce commit 0feccbf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/sage_intacct/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,7 @@ def process_fyle_reimbursements(workspace_id):
def mark_paid_on_fyle(platform, payloads:dict, reports_to_be_marked, workspace_id, retry_num=10):
try:
logger.info('Marking reports paid on fyle for report ids - %s', reports_to_be_marked)
logger.info('Payloads- %s', payloads)
platform.reports.bulk_mark_as_paid(payloads)
Expense.objects.filter(report_id__in=list(reports_to_be_marked), workspace_id=workspace_id, paid_on_fyle=False).update(paid_on_fyle=True)
except Exception as e:
Expand All @@ -1410,7 +1411,7 @@ def mark_paid_on_fyle(platform, payloads:dict, reports_to_be_marked, workspace_i
if retry_num > 0 and payloads:
retry_num -= 1
logger.info('Retrying to mark reports paid on fyle, retry_num=%d', retry_num)
mark_paid_on_fyle(platform, payloads, reports_to_be_marked, retry_num)
mark_paid_on_fyle(platform, payloads, reports_to_be_marked, workspace_id, retry_num)

else:
logger.info('Retry limit reached or no payloads left. Failed to process payloads - %s:', reports_to_be_marked)
Expand Down

0 comments on commit 0feccbf

Please sign in to comment.