Skip to content

Commit

Permalink
Fixing bug in Vendor Creation (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shwetabhk authored Sep 26, 2022
1 parent cb6b37a commit edb1ea9
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions apps/quickbooks_online/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,17 @@ def get_or_create_credit_card_or_debit_card_vendor(workspace_id: int, merchant:
except WrongParamsError as bad_request:
logger.error(bad_request.response)

if not vendor and general_settings.auto_create_merchants_as_vendors:
try:
vendor = qbo_connection.get_or_create_vendor(merchant, create=True)
except WrongParamsError as bad_request:
logger.error(bad_request.response)
else:
if debit_card_expense:
vendor = qbo_connection.get_or_create_vendor('Debit Card Misc', create=True)
else:
vendor = qbo_connection.get_or_create_vendor('Credit Card Misc', create=True)
if not vendor:
if general_settings.auto_create_merchants_as_vendors:
try:
vendor = qbo_connection.get_or_create_vendor(merchant, create=True)
except WrongParamsError as bad_request:
logger.error(bad_request.response)
if not vendor:
if debit_card_expense:
vendor = qbo_connection.get_or_create_vendor('Debit Card Misc', create=True)
else:
vendor = qbo_connection.get_or_create_vendor('Credit Card Misc', create=True)

return vendor

Expand Down

0 comments on commit edb1ea9

Please sign in to comment.