Skip to content

Commit

Permalink
Merge pull request #22 from lumapps/feat/salesorders-stream
Browse files Browse the repository at this point in the history
Feat/salesorders stream
  • Loading branch information
quentinlumapps authored Oct 11, 2024
2 parents 78df872 + 9893b10 commit ffeeaf0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tap_netsuitesuiteql/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ class SalesOrdersStream(NetsuiteSuiteQLStream):
name = "sales_orders"
path = ""
primary_keys = ["unique_key"]
query = "SELECT TL.uniqueKey unique_key, T.entityStatus entity_status, T.id id, T.type tran_type, PREV.previousDoc previous_estimate, TS.fullName tran_status, TCS.name approval_status, T.tranId tran_id, T.tranDate tran_date, T.custbody_prq_end_user enduser_id, T.entity bill_to_customer_id, T.custbody_prq_contract contract_id, C.custrecord_prq_ct_partner partner_id, CT.name contract_type, CAREA.name contract_area, TC.symbol currency, T.exchangeRate exchange_rate, TL.subsidiary subsidiary, S.name subsidiary_name, SC.symbol subsidiary_currency, S.custrecord_lum_fixedfxusd_sub fixed_exchange_rate_usd, S.custrecord_lum_fixedfxusd19_sub fixed_exchange_rate_usd19, T.startDate tran_start_date, T.endDate tran_end_date, T.custbody_prq_months tran_months, TREV.name revenue, TLLOC.name location, T.custbody_prq_carr carr, T.custbody_lum_incrementalcarr incremental_carr, T.custbody_prq_carr_start_date carr_start_date, T.custbody_prq_carr_end_date carr_end_date, T.custbody_prq_product main_item_id, TPRODUCT.fullName main_item_name, TPRODUCT.displayName main_item_display_name, T.custbody_prq_customer_success_manager csm, T.employee sales_rep, T.custbody_prq_renewal renewal, T.custbody_prq_renewal_start_date renewal_start_date, T.custbody_prq_renewal_end_date renewal_end_date, T.custbody_prq_renewal_months renewal_months, T.custbody_prq_renewed renewed, T.custbody_prq_renewal_linked_trans renewal_estimate, TL.id line_id, TL.custcol_prq_billing_so_line line, TL.cseg_prq_revenue line_revenue, TL.custcol_lum_hubspot_line hubspot_line, TL.item item_id, I.fullName item_name, I.displayName item_display_name, IF.name product_family, TL.custcol_prq_users users, TL.quantity amount_excluding_tax, TL.rate quantity, TL.netAmount net_amount, TL.memo description, TL.isclosed is_closed, TL.custcol_prq_start_date line_start_date, TL.custcol_prq_end_date line_end_date, TL.custcol_prq_months line_months, TL.custcol_prq_renewal line_renewal, TL.custcol_prq_arr_calculation arr_calc, T.createdDate created_date, TL.custcol_prq_billing_period_from billing_period_from, TL.custcol_prq_billing_period_to billing_period_to FROM transaction T LEFT JOIN transactionline TL ON TL.transaction = T.id LEFT JOIN customer CE ON CE.id = T.custbody_prq_end_user LEFT JOIN item I ON I.id = TL.item LEFT JOIN subsidiary S ON S.id = TL.subsidiary LEFT JOIN currency SC ON SC.id=S.currency LEFT JOIN customrecord_prq_contract C ON C.id = T.custbody_prq_contract LEFT JOIN transactionStatus TS ON T.status = TS.id AND T.type = TS.trantype AND T.customtype = TS.trancustomtype LEFT JOIN CUSTOMLIST_PRQ_APPROVAL_CUSTOM_STATUS TCS ON T.custbody_prq_approval_custom_status = TCS.id LEFT JOIN CUSTOMLIST_PRQ_CONTRACT_TYPE CT ON T.custbody_prq_contract_type = CT.id LEFT JOIN CUSTOMLIST_PRQ_CONTRACT_GEO_AREA CAREA ON C.custrecord_prq_ct_geographical_area = CAREA.id LEFT JOIN currency TC ON T.currency=TC.id LEFT JOIN CUSTOMRECORD_CSEG_PRQ_REVENUE TREV ON T.cseg_prq_revenue = TREV.id LEFT JOIN Location TLLOC ON TL.location = TLLOC.id LEFT JOIN item TPRODUCT ON T.custbody_prq_product = TPRODUCT.id LEFT JOIN CUSTOMRECORD_LUM_PRODUCTFAMILY_MA IF ON I.custitem_lum_productfamily_ma = IF.id LEFT JOIN PreviousTransactionLink PREV ON PREV.nextdoc=T.id WHERE (T.type='SalesOrd' OR T.type='Estimate') AND TL.mainLine = 'F' AND TL.taxLine = 'F' AND CT.name = 'Subscription' ORDER BY unique_key"
query = "SELECT TL.uniqueKey unique_key, T.entityStatus entity_status, T.id id, T.type tran_type, PREV.previousDoc previous_estimate, TS.fullName tran_status, TCS.name approval_status, T.tranId tran_id, T.tranDate tran_date, T.custbody_prq_end_user enduser_id, T.entity bill_to_customer_id, T.custbody_prq_contract contract_id, C.custrecord_prq_ct_partner partner_id, CT.name contract_type, CAREA.name contract_area, TC.symbol currency, T.exchangeRate exchange_rate, TL.subsidiary subsidiary, S.name subsidiary_name, SC.symbol subsidiary_currency, S.custrecord_lum_fixedfxusd_sub fixed_exchange_rate_usd, S.custrecord_lum_fixedfxusd19_sub fixed_exchange_rate_usd19, T.startDate tran_start_date, T.endDate tran_end_date, T.custbody_prq_months tran_months, TREV.name revenue, TLLOC.name location, T.custbody_prq_carr carr, T.custbody_lum_incrementalcarr incremental_carr, T.custbody_prq_carr_start_date carr_start_date, T.custbody_prq_carr_end_date carr_end_date, T.custbody_prq_product main_item_id, TPRODUCT.fullName main_item_name, TPRODUCT.displayName main_item_display_name, T.custbody_prq_customer_success_manager csm, T.employee sales_rep, T.custbody_prq_renewal renewal, T.custbody_prq_renewal_start_date renewal_start_date, T.custbody_prq_renewal_end_date renewal_end_date, T.custbody_prq_renewal_months renewal_months, T.custbody_prq_renewed renewed, T.custbody_prq_renewal_linked_trans renewal_estimate, TL.id line_id, TL.custcol_prq_billing_so_line line, TL.cseg_prq_revenue line_revenue, TL.custcol_lum_hubspot_line hubspot_line, TL.item item_id, I.fullName item_name, I.displayName item_display_name, IF.name product_family, TL.custcol_prq_users users, TL.quantity amount_excluding_tax, TL.rate quantity, TL.netAmount net_amount, TL.memo description, TL.isclosed is_closed, TL.custcol_prq_start_date line_start_date, TL.custcol_prq_end_date line_end_date, TL.custcol_prq_months line_months, TL.custcol_prq_renewal line_renewal, TL.custcol_prq_arr_calculation arr_calc, T.createdDate created_date, TL.custcol_prq_billing_period_from billing_period_from, TL.custcol_prq_billing_period_to billing_period_to, RS.name renewal_status, RT.tranDate renewal_tran_date, T.custbody_prq_arr arr_legacy FROM transaction T LEFT JOIN transactionline TL ON TL.transaction = T.id LEFT JOIN customer CE ON CE.id = T.custbody_prq_end_user LEFT JOIN item I ON I.id = TL.item LEFT JOIN subsidiary S ON S.id = TL.subsidiary LEFT JOIN currency SC ON SC.id=S.currency LEFT JOIN customrecord_prq_contract C ON C.id = T.custbody_prq_contract LEFT JOIN transactionStatus TS ON T.status = TS.id AND T.type = TS.trantype AND T.customtype = TS.trancustomtype LEFT JOIN CUSTOMLIST_PRQ_APPROVAL_CUSTOM_STATUS TCS ON T.custbody_prq_approval_custom_status = TCS.id LEFT JOIN CUSTOMLIST_PRQ_CONTRACT_TYPE CT ON T.custbody_prq_contract_type = CT.id LEFT JOIN CUSTOMLIST_PRQ_CONTRACT_GEO_AREA CAREA ON C.custrecord_prq_ct_geographical_area = CAREA.id LEFT JOIN currency TC ON T.currency=TC.id LEFT JOIN CUSTOMRECORD_CSEG_PRQ_REVENUE TREV ON T.cseg_prq_revenue = TREV.id LEFT JOIN Location TLLOC ON TL.location = TLLOC.id LEFT JOIN item TPRODUCT ON T.custbody_prq_product = TPRODUCT.id LEFT JOIN CUSTOMRECORD_LUM_PRODUCTFAMILY_MA IF ON I.custitem_lum_productfamily_ma = IF.id LEFT JOIN PreviousTransactionLink PREV ON PREV.nextdoc=T.id LEFT JOIN CUSTOMLIST_LUM_RENEWAL_STATUS RS ON T.custbody_lum_renewal_status = RS.id LEFT JOIN transaction RT ON T.custbody_prq_renewal_linked_trans = RT.id WHERE (T.type='SalesOrd' OR T.type='Estimate') AND TL.mainLine = 'F' AND TL.taxLine = 'F' AND CT.name = 'Subscription' ORDER BY unique_key"
replication_key = None

schema = th.PropertiesList(
th.Property("unique_key", th.IntegerType),
th.Property("id", th.IntegerType),
th.Property("entity_status", th.StringType),
th.Property("entity_status", th.IntegerType),
th.Property("previous_estimate", th.IntegerType),
th.Property("tran_type", th.StringType),
th.Property("tran_status", th.StringType),
Expand Down Expand Up @@ -190,6 +190,9 @@ class SalesOrdersStream(NetsuiteSuiteQLStream):
th.Property("created_date", th.DateType),
th.Property("billing_period_from", th.DateType),
th.Property("billing_period_to", th.DateType),
th.Property("renewal_status", th.StringType),
th.Property("renewal_tran_date", th.DateType),
th.Property("arr_legacy", th.NumberType)

).to_dict()

Expand Down

0 comments on commit ffeeaf0

Please sign in to comment.