diff --git a/netsuitesdk/api/journal_entries.py b/netsuitesdk/api/journal_entries.py index 7ad59f9..18868ba 100644 --- a/netsuitesdk/api/journal_entries.py +++ b/netsuitesdk/api/journal_entries.py @@ -29,6 +29,9 @@ def __init__(self, ns_client): ApiBase.__init__(self, ns_client=ns_client, type_name=self.TYPE_NAME) # Uppercase the first letter of the type name to get the class name self.class_name = self.type_name[:1].upper() + self.type_name[1:] + self.class_ = getattr(ns_client, self.class_name) + self.line_class_ = getattr(ns_client, self.class_name + 'Line') + self.line_list_class_ = getattr(ns_client, self.class_name + 'LineList') def get_all_generator(self): record_type_search_field = self.ns_client.SearchStringField(searchValue=self.class_name, operator='contains') @@ -41,7 +44,7 @@ def get_all_generator(self): def post(self, data) -> OrderedDict: assert data['externalId'], 'missing external id' - je = self.ns_client.JournalEntry(externalId=data['externalId']) + je = self.class_(externalId=data['externalId']) line_list = [] for eod in data['lineList']: if 'customFieldList' in eod and eod['customFieldList']: @@ -66,10 +69,10 @@ def post(self, data) -> OrderedDict: ) ) eod['customFieldList'] = self.ns_client.CustomFieldList(custom_fields) - jee = self.ns_client.JournalEntryLine(**eod) + jee = self.line_class_(**eod) line_list.append(jee) - je['lineList'] = self.ns_client.JournalEntryLineList(line=line_list) + je['lineList'] = self.line_list_class_(line=line_list) self.build_simple_fields(self.SIMPLE_FIELDS, data, je) self.build_record_ref_fields(self.RECORD_REF_FIELDS, data, je) diff --git a/setup.py b/setup.py index 1d1b683..c6202dd 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name='netsuitesdk', - version='2.16.4', + version='2.16.5', author='Siva Narayanan', author_email='siva@fyle.in', description='Python SDK for accessing the NetSuite SOAP webservice',