Skip to content

Commit

Permalink
Fixed destination id none while posting vendor (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrishabh17 authored May 2, 2024
1 parent b52999a commit 631b3d4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/quickbooks_online/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,10 @@ def post_bill_payment(self, bill_payment: BillPayment, bill_payment_lineitems: L
created_bill_payment = self.connection.bill_payments.post(bill_payment_payload)
return created_bill_payment

def create_credit_card_misc_vendor(self):
created_vendor = self.get_or_create_vendor('Credit Card Misc', create=True)
return created_vendor.destination_id

def __get_entity_id(self, general_settings: WorkspaceGeneralSettings, value: str, employee_field_mapping: str,
fund_source: str):
if fund_source == 'PERSONAL' or (fund_source == 'CCC' and general_settings.name_in_journal_entry == 'EMPLOYEE'):
Expand All @@ -1115,10 +1119,11 @@ def __get_entity_id(self, general_settings: WorkspaceGeneralSettings, value: str
return entity.destination_employee.destination_id if employee_field_mapping == 'EMPLOYEE' else entity.destination_vendor.destination_id
elif general_settings.name_in_journal_entry == 'MERCHANT' and general_settings.auto_create_merchants_as_vendors and value:
created_vendor = self.get_or_create_vendor(value, create=True)
if not created_vendor:
return self.create_credit_card_misc_vendor()
return created_vendor.destination_id
else:
created_vendor = self.get_or_create_vendor('Credit Card Misc', create=True)
return created_vendor.destination_id
return self.create_credit_card_misc_vendor()

def get_or_create_entity(self, expense_group: ExpenseGroup, general_settings: WorkspaceGeneralSettings):
entity_map = {}
Expand Down

0 comments on commit 631b3d4

Please sign in to comment.