Skip to content

Commit

Permalink
Bug fix in Process reimburse handle (#380)
Browse files Browse the repository at this point in the history
* Handling exception properly

* flake linting

* Proper excpetional handling

* Flake linting

* bug fix

* fix

* fix response in exception

* used import removed

* comment resolved

* Handle permission denied case

* Bug fix
  • Loading branch information
Ashutosh619-sudo committed Jun 26, 2024
1 parent 6cbe380 commit 40fa535
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/xero/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ def process_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 @@ -829,7 +830,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 40fa535

Please sign in to comment.