Skip to content

Commit

Permalink
fix: Bill Number (Add Safety) (#672)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions <[email protected]>
  • Loading branch information
ruuushhh and GitHub Actions committed Sep 24, 2024
1 parent 00a2d4f commit f4c32cb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/quickbooks_online/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ def get_bill_number(expense_group: ExpenseGroup):
bill_number_field = 'expense_number'

bill_number = expense_group.expenses.first().__getattribute__(bill_number_field)

count = Bill.objects.filter(bill_number=bill_number, expense_group__workspace_id=expense_group.workspace.id).count()
if count > 0:
bill_number = '{} - {}'.format(bill_number, count)
return bill_number


Expand Down

0 comments on commit f4c32cb

Please sign in to comment.