Skip to content

Commit

Permalink
Ignore vendor when display name not present (#147)
Browse files Browse the repository at this point in the history
* Ignore vendor when display name not present

* comment resolved

* resolve comment

* comment resolved

* comment resolved

* comment resolved
  • Loading branch information
Ashutosh619-sudo committed Jul 3, 2024
1 parent 7795584 commit f0d4d84
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apps/business_central/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ def _sync_data(self, data, attribute_type, display_name, workspace_id, field_nam

destination_attributes = []
for item in data:
value = None
if 'displayName' in item and item['displayName']:
value = item['displayName']
elif 'name' in item and item['name']:
value = item['name']

if not value:
continue
detail = {field: item[field] for field in field_names}
if (attribute_type == 'EMPLOYEE' and item.get('status') == 'Active') or (attribute_type in ('LOCATION', 'COMPANY')) or (item.get('blocked') is not None and item.get('blocked') != True):
active = True
Expand All @@ -81,7 +89,7 @@ def _sync_data(self, data, attribute_type, display_name, workspace_id, field_nam
destination_attributes.append(self._create_destination_attribute(
attribute_type,
display_name,
item['displayName'] if item['displayName'] else item['name'],
value,
item['number'] if item.get('number') else item['id'],
active,
detail
Expand Down

0 comments on commit f0d4d84

Please sign in to comment.