diff --git a/netsuitesdk/api/employees.py b/netsuitesdk/api/employees.py index e001425..5e4f99a 100644 --- a/netsuitesdk/api/employees.py +++ b/netsuitesdk/api/employees.py @@ -1,5 +1,7 @@ from collections import OrderedDict +from netsuitesdk.internal.utils import PaginatedSearch + from .base import ApiBase import logging @@ -10,6 +12,36 @@ class Employees(ApiBase): def __init__(self, ns_client): ApiBase.__init__(self, ns_client=ns_client, type_name='Employee') + def get_all_generator(self, is_inactive=False, last_modified_date_query={ + 'search_value', + 'operator', + }): + # Get Only Employee Items using SearchBooleanField + record_type_search_field = self.ns_client.SearchBooleanField(searchValue=is_inactive) + + date_search = None + if 'search_value' in last_modified_date_query and 'operator' in last_modified_date_query: + if last_modified_date_query['search_value'] and last_modified_date_query['operator']: + date_search = self.ns_client.SearchDateField( + searchValue=last_modified_date_query['search_value'], + operator=last_modified_date_query['operator'] + ) + + basic_search = self.ns_client.basic_search_factory( + type_name='Employee', + isInactive=record_type_search_field, + lastModifiedDate=date_search + ) + + paginated_search = PaginatedSearch( + client=self.ns_client, + type_name='Employee', + basic_search=basic_search, + pageSize=500 + ) + + return self._paginated_search_generator(paginated_search=paginated_search) + def post(self, data) -> OrderedDict: assert data['externalId'], 'missing external id' employee = self.ns_client.Employee(externalId=data['externalId']) diff --git a/setup.py b/setup.py index 6df6055..0ab80a1 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='netsuitesdk', - version='2.19.2', + version='2.20.0', author='Siva Narayanan', author_email='siva@fyle.in', description='Python SDK for accessing the NetSuite SOAP webservice',