diff --git a/apps/quickbooks_online/utils.py b/apps/quickbooks_online/utils.py index 9a30c258..ce38ee80 100644 --- a/apps/quickbooks_online/utils.py +++ b/apps/quickbooks_online/utils.py @@ -260,6 +260,7 @@ def sync_tax_codes(self): 'display_name': 'Tax Code', 'value': '{0} @{1}%'.format(tax_code['Name'], effective_tax_rate), 'destination_id': tax_code['Id'], + 'active': True, 'detail': { 'tax_rate': effective_tax_rate, 'tax_refs': tax_rates @@ -333,6 +334,7 @@ def create_vendor_destionation_attribute(self, vendor): 'display_name': 'vendor', 'value': vendor['DisplayName'], 'destination_id': vendor['Id'], + 'active': vendor['Active'], 'detail': { 'email': vendor['PrimaryEmailAddr']['Address'] if 'PrimaryEmailAddr' in vendor else None } @@ -386,7 +388,8 @@ def sync_employees(self): 'display_name': 'employee', 'value': employee['DisplayName'], 'destination_id': employee['Id'], - 'detail': detail + 'detail': detail, + 'active': True }) DestinationAttribute.bulk_create_or_update_destination_attributes( diff --git a/apps/quickbooks_online/views.py b/apps/quickbooks_online/views.py index d178b212..02e81926 100644 --- a/apps/quickbooks_online/views.py +++ b/apps/quickbooks_online/views.py @@ -898,15 +898,12 @@ class DestinationAttributesView(generics.ListAPIView): def get_queryset(self): attribute_types = self.request.query_params.get('attribute_types').split(',') - active = self.request.query_params.get('active') filters = { 'attribute_type__in' : attribute_types, - 'workspace_id': self.kwargs['workspace_id'] + 'workspace_id': self.kwargs['workspace_id'], + 'active': True } - if active and active.lower() == 'true': - filters['active'] = True - return DestinationAttribute.objects.filter(**filters).order_by('value')