Skip to content

Commit

Permalink
Revert Journal Entry class breaking changes (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwin1111 authored Feb 15, 2023
1 parent a2d327d commit 0b86bcf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions netsuitesdk/api/journal_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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']:
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='netsuitesdk',
version='2.16.4',
version='2.16.5',
author='Siva Narayanan',
author_email='[email protected]',
description='Python SDK for accessing the NetSuite SOAP webservice',
Expand Down

0 comments on commit 0b86bcf

Please sign in to comment.