Skip to content

Commit

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

* flake resovled
  • Loading branch information
Ashutosh619-sudo authored Jun 21, 2024
1 parent 375ab66 commit 0ca9e6e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions apps/quickbooks_online/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,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 async_sync_accounts(workspace_id):
Expand Down

0 comments on commit 0ca9e6e

Please sign in to comment.