Skip to content

Commit

Permalink
Duplicate vendor name exists (#407)
Browse files Browse the repository at this point in the history
* Duplicate vendot name exists

* Comments resolved

* Comments resolved
  • Loading branch information
ruuushhh authored Apr 14, 2023
1 parent 0c953a9 commit 8b30d84
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/quickbooks_online/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def get_or_create_vendor(self, vendor_name: str, email: str = None, create: bool

if not vendor:
if create:
#safe check to avoid duplicate vendor name exist error
if DestinationAttribute.objects.filter(attribute_type__in=['CUSTOMER', 'EMPLOYEE'], value=vendor_name, workspace_id=self.workspace_id).exists():
return
created_vendor = self.post_vendor(vendor_name, email)
return self.create_vendor_destionation_attribute(created_vendor)
else:
Expand Down

0 comments on commit 8b30d84

Please sign in to comment.