Skip to content

Commit

Permalink
Merge pull request #19 from hotgluexyz/fix/salesOrders
Browse files Browse the repository at this point in the history
Fix/sales orders
  • Loading branch information
hsyyid authored Mar 1, 2022
2 parents 562025d + 331909e commit 8372b47
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='tap-netsuite',
version='1.5.11',
version='1.5.12',
description='Singer.io tap for extracting data from the NetSuite SOAP',
author='hotglue',
url='https://hotglue.xyz/',
Expand Down
36 changes: 14 additions & 22 deletions tap_netsuite/netsuite/transaction_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_all(self, last_modified_date=None):
return list(self.get_all_generator() if last_modified_date is None else self.get_all_generator(
last_modified_date=last_modified_date))

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
search_record = self.ns_client.basic_search_factory(type_name="Customer",
lastModifiedDate=last_modified_date)
ps = PaginatedSearch(client=self.ns_client, type_name='Customer', pageSize=page_size,
Expand All @@ -63,7 +63,7 @@ def get_all(self, last_modified_date=None):
return list(self.get_all_generator() if last_modified_date is None else self.get_all_generator(
last_modified_date=last_modified_date))

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='InventoryItem', operator='contains')
search_record = self.ns_client.basic_search_factory(type_name="Item",
recordType=record_type_search_field,
Expand All @@ -85,7 +85,7 @@ def get_all(self, last_modified_date=None):
return list(self.get_all_generator() if last_modified_date is None else self.get_all_generator(
last_modified_date=last_modified_date))

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='Opportunity', operator='contains')
basic_search = self.ns_client.basic_search_factory('Transaction', recordType=record_type_search_field,
lastModifiedDate=last_modified_date)
Expand All @@ -103,19 +103,11 @@ class SalesOrders(ApiBase):
def __init__(self, ns_client):
ApiBase.__init__(self, ns_client=ns_client, type_name='salesOrder')
self.require_lastModified_date = True

@staticmethod
def page_generator(paginated_search):
if paginated_search.num_records != 0:
num_pages = paginated_search.total_pages
for p in range(1, num_pages + 1):
paginated_search.goto_page(p)
yield paginated_search.records

def get_all(self, last_modified_date=None):
return self.get_all_generator(last_modified_date=last_modified_date)

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='SalesOrder', operator='contains')
basic_search = self.ns_client.basic_search_factory('Transaction',
lastModifiedDate=last_modified_date,
Expand All @@ -125,7 +117,7 @@ def get_all_generator(self, page_size=100, last_modified_date=None):
type_name='Transaction',
pageSize=page_size)

return self.page_generator(paginated_search)
return self._paginated_search_to_generator(paginated_search=paginated_search)

def post(self, data) -> OrderedDict:
return None
Expand All @@ -139,7 +131,7 @@ def get_all(self, last_modified_date=None):
return list(self.get_all_generator() if last_modified_date is None else self.get_all_generator(
last_modified_date=last_modified_date))

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='InventoryTransfer', operator='contains')
basic_search = self.ns_client.basic_search_factory('Transaction',
recordType=record_type_search_field,
Expand All @@ -163,7 +155,7 @@ def get_all(self, last_modified_date=None):
return list(self.get_all_generator() if last_modified_date is None else self.get_all_generator(
last_modified_date=last_modified_date))

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
search_record = self.ns_client.basic_search_factory(type_name="Item",
lastModifiedDate=last_modified_date)
ps = PaginatedSearch(client=self.ns_client, type_name='Item', pageSize=page_size,
Expand All @@ -182,7 +174,7 @@ def get_all(self, last_modified_date=None):
return list(self.get_all_generator() if last_modified_date is None else self.get_all_generator(
last_modified_date=last_modified_date))

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='InventoryAdjustment', operator='contains')
basic_search = self.ns_client.basic_search_factory('Transaction',
recordType=record_type_search_field,
Expand All @@ -205,7 +197,7 @@ def get_all(self, last_modified_date=None):
return list(self.get_all_generator() if last_modified_date is None else self.get_all_generator(
last_modified_date=last_modified_date))

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='VendorBill', operator='contains')
basic_search = self.ns_client.basic_search_factory('Transaction',
recordType=record_type_search_field,
Expand All @@ -227,7 +219,7 @@ def get_all(self, last_modified_date=None):
return list(self.get_all_generator() if last_modified_date is None else self.get_all_generator(
last_modified_date=last_modified_date))

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='VendorPayment', operator='contains')
basic_search = self.ns_client.basic_search_factory('Transaction',
recordType=record_type_search_field,
Expand All @@ -251,7 +243,7 @@ def get_all(self, last_modified_date=None):
return list(self.get_all_generator() if last_modified_date is None else self.get_all_generator(
last_modified_date=last_modified_date))

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='JournalEntry', operator='contains')
basic_search = self.ns_client.basic_search_factory('Transaction',
lastModifiedDate=last_modified_date,
Expand Down Expand Up @@ -313,7 +305,7 @@ def get_all(self, last_modified_date=None):
return list(self.get_all_generator() if last_modified_date is None else self.get_all_generator(
last_modified_date=last_modified_date))

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='Invoice', operator='contains')
basic_search = self.ns_client.basic_search_factory('Transaction',
lastModifiedDate=last_modified_date,
Expand All @@ -339,7 +331,7 @@ def __init__(self, ns_client):
def get_all(self, last_modified_date=None):
return self.get_all_generator(last_modified_date=last_modified_date)

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='CreditMemo', operator='contains')
basic_search = self.ns_client.basic_search_factory('Transaction',
lastModifiedDate=last_modified_date,
Expand All @@ -364,7 +356,7 @@ def __init__(self, ns_client):
def get_all(self, last_modified_date=None):
return self.get_all_generator(last_modified_date=last_modified_date)

def get_all_generator(self, page_size=100, last_modified_date=None):
def get_all_generator(self, page_size=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='PurchaseOrder', operator='contains')
basic_search = self.ns_client.basic_search_factory('Transaction',
lastModifiedDate=last_modified_date,
Expand Down

0 comments on commit 8372b47

Please sign in to comment.