Skip to content

Commit

Permalink
Bug fix for marking expense paid (#376)
Browse files Browse the repository at this point in the history
* Bug fix for marking expense paid

* flake resolved
  • Loading branch information
Ashutosh619-sudo authored Jun 21, 2024
1 parent c06da73 commit 68c3088
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions apps/xero/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,10 +802,18 @@ def process_reimbursements(workspace_id):
payloads.append({'id': report_id, 'paid_notify_at': datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%fZ')})
expenses_to_be_marked.extend(paid_expenses)

platform.reports.bulk_mark_as_paid(payloads)
if expenses_to_be_marked:
expense_ids_to_mark = [expense.id for expense in expenses_to_be_marked]
Expense.objects.filter(id__in=expense_ids_to_mark).update(paid_on_fyle=True)
if payloads:
try:
platform.reports.bulk_mark_as_paid(payloads)
if expenses_to_be_marked:
expense_ids_to_mark = [expense.id for expense in expenses_to_be_marked]
Expense.objects.filter(id__in=expense_ids_to_mark).update(paid_on_fyle=True)
except Exception as error:
error = traceback.format_exc()
error = {
'error': error
}
logger.exception(error)


def create_missing_currency(workspace_id: int):
Expand Down

0 comments on commit 68c3088

Please sign in to comment.