Skip to content

Feature - Work Orders stream #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tap_netsuite/netsuite/netsuite_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import time
import json
import singer
from .transaction_entities import Customers, PurchaseOrder, Invoice, JournalEntries, InventoryTransfer, InventoryAdjustment, InventoryItem, VendorBills, VendorPayments, SalesOrders, CreditMemos, Items
from .transaction_entities import Customers, PurchaseOrder, Invoice, JournalEntries, InventoryTransfer, InventoryAdjustment, InventoryItem, VendorBills, VendorPayments, SalesOrders, CreditMemos, Items, WorkOrder
from .netsuite_client import ExtendedNetSuiteClient

LOGGER = singer.get_logger()
Expand Down Expand Up @@ -74,7 +74,8 @@ def __init__(self, account, consumer_key, consumer_secret, token_key, token_secr
'Items': Items(ns_client),
'PurchaseOrder': PurchaseOrder(ns_client),
"Subsidiaries": self.subsidiaries,
"TaxItems": TaxItems(ns_client)
"TaxItems": TaxItems(ns_client),
'WorkOrder': WorkOrder(ns_client)
}

def _query_entity(self, data, entity, stream):
Expand Down
35 changes: 35 additions & 0 deletions tap_netsuite/netsuite/schemas/object_definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -932,5 +932,40 @@
{"displayName": "TranDate", "name": "tranDate", "type": "datetime"},
{"displayName": "TranId", "name": "tranId", "type": "string"},
{"displayName": "VatRegNum", "name": "vatRegNum", "type": "string"}
],
"WorkOrder": [
{"displayName": "AccountingBookDetailList", "name": "accountingBookDetailList", "type": "string"},
{"displayName": "AssemblyItemRef", "name": "assemblyItem", "type": "string"},
{"displayName": "BillOfMaterialsRef", "name": "billOfMaterials", "type": "string"},
{"displayName": "BillOfMaterialsRevisionRef", "name": "billOfMaterialsRevision", "type": "string"},
{"displayName": "Built", "name": "build", "type": "number"},
{"displayName": "ClassRef", "name": "class", "type": "string"},
{"displayName": "CreatedDate", "name": "createdDate", "type": "datetime"},
{"displayName": "CreatedFrom", "name": "createdFrom", "type": "string"},
{"displayName": "CustomFieldList", "name": "customFieldList", "type": "string"},
{"displayName": "CustomFormRef", "name": "customForm", "type": "string"},
{"displayName": "DepartmentRef", "name": "department", "type": "string"},
{"displayName": "EndDate", "name": "endDate", "type": "datetime"},
{"displayName": "EntityRef", "name": "entity", "type": "string"},
{"displayName": "ExpandAssembly", "name": "expandAssembly", "type": "boolean"},
{"displayName": "ExternalId", "name": "externalId", "type": "string"},
{"displayName": "Firmed", "name": "firmed", "type": "boolean"},
{"displayName": "Id", "name": "internalId", "type": "string"},
{"displayName": "ItemList", "name": "itemList", "type": "string"},
{"displayName": "Job", "name": "job", "type": "string"},
{"displayName": "LastModifiedDate", "name": "lastModifiedDate", "type": "datetime"},
{"displayName": "LocationRef", "name": "location", "type": "string"},
{"displayName": "Memo", "name": "memo", "type": "string"},
{"displayName": "NullFieldList", "name": "nullFieldList", "type": "string"},
{"displayName": "OrderStatus", "name": "orderStatus", "type": "string"},
{"displayName": "PartnersList", "name": "partnersList", "type": "string"},
{"displayName": "Quantity", "name": "quantity", "type": "number"},
{"displayName": "SalesTeamList", "name": "salesTeamList", "type": "string"},
{"displayName": "StartDate", "name": "startDate", "type": "datetime"},
{"displayName": "Status", "name": "status", "type": "string"},
{"displayName": "Subsidiary", "name": "subsidiary", "type": "string"},
{"displayName": "TranDate", "name": "tranDate", "type": "datetime"},
{"displayName": "TranId", "name": "tranId", "type": "string"},
{"displayName": "Units", "name": "units", "type": "number"}
]
}
28 changes: 27 additions & 1 deletion tap_netsuite/netsuite/transaction_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,4 +360,30 @@ def get_all_generator(self, page_size=200, last_modified_date=None):
return self._paginated_search_to_generator(paginated_search=paginated_search)

def post(self, data) -> OrderedDict:
return None
return None


class WorkOrder(ApiBase):
def __init__(self, ns_client):
ApiBase.__init__(self, ns_client=ns_client, type_name='WorkOrder')
self.require_paging = True
self.require_lastModified_date = True

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=200, last_modified_date=None):
record_type_search_field = self.ns_client.SearchStringField(searchValue='WorkOrder', operator='contains')
basic_search = self.ns_client.basic_search_factory('Transaction',
lastModifiedDate=last_modified_date,
recordType=record_type_search_field)

paginated_search = PaginatedSearch(client=self.ns_client,
basic_search=basic_search,
type_name='Transaction',
pageSize=page_size)

return self._paginated_search_to_generator(paginated_search=paginated_search)

def post(self, data) -> OrderedDict:
return None