Skip to content

Commit

Permalink
Fix: Add order to Vendor Search (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruuushhh authored May 20, 2024
1 parent 7416f14 commit c73d674
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/quickbooks_online/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def create_qbo_expense(expense_group: ExpenseGroup):
if workspace_general_settings.map_merchant_to_vendor and expense_group.fund_source == 'CCC':
merchant = expense.vendor if expense.vendor else ''

entity = DestinationAttribute.objects.filter(value__iexact=merchant, attribute_type='VENDOR', workspace_id=expense_group.workspace_id, active=True).first()
entity = DestinationAttribute.objects.filter(value__iexact=merchant, attribute_type='VENDOR', workspace_id=expense_group.workspace_id, active=True).order_by('-updated_at').first()

if not entity:
entity_id = DestinationAttribute.objects.filter(value='Debit Card Misc', workspace_id=expense_group.workspace_id).first().destination_id
Expand Down Expand Up @@ -596,7 +596,7 @@ def create_credit_card_purchase(expense_group: ExpenseGroup, map_merchant_to_ven
if map_merchant_to_vendor:
merchant = expense.vendor if expense.vendor else ''

entity = DestinationAttribute.objects.filter(value__iexact=merchant, attribute_type='VENDOR', workspace_id=expense_group.workspace_id, active=True).first()
entity = DestinationAttribute.objects.filter(value__iexact=merchant, attribute_type='VENDOR', workspace_id=expense_group.workspace_id, active=True).order_by('-updated_at').first()

if not entity:
entity_id = DestinationAttribute.objects.filter(value='Credit Card Misc', workspace_id=expense_group.workspace_id).first().destination_id
Expand Down

0 comments on commit c73d674

Please sign in to comment.