Skip to content

Commit

Permalink
Fix Journal Entry class (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwin1111 authored Jan 30, 2023
1 parent ed1d779 commit 634015d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions netsuitesdk/api/journal_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ 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 @@ -44,7 +41,7 @@ def get_all_generator(self):

def post(self, data) -> OrderedDict:
assert data['externalId'], 'missing external id'
je = self.class_(externalId=data['externalId'])
je = self.ns_client.JournalEntry(externalId=data['externalId'])
line_list = []
for eod in data['lineList']:
if 'customFieldList' in eod and eod['customFieldList']:
Expand All @@ -69,10 +66,10 @@ def post(self, data) -> OrderedDict:
)
)
eod['customFieldList'] = self.ns_client.CustomFieldList(custom_fields)
jee = self.line_class_(**eod)
jee = self.ns_client.JournalEntryLine(**eod)
line_list.append(jee)

je['lineList'] = self.line_list_class_(line=line_list)
je['lineList'] = self.ns_client.JournalEntryLineList(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.1',
version='2.16.2',
author='Siva Narayanan',
author_email='[email protected]',
description='Python SDK for accessing the NetSuite SOAP webservice',
Expand Down

5 comments on commit 634015d

@mroy-seedbox
Copy link
Contributor

@mroy-seedbox mroy-seedbox commented on 634015d Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashwin1111: What does this commit fix?

It actually breaks AdvInterCompanyJournalEntries, which depends on the removed code.

This change should be reverted.

@ashwin1111
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies @mroy-seedbox, we'll get this fixed by early next week. We had some trouble while running tests and I made a quick fix without checking that this is being used in AdvInterCompanyJournalEntries.

    self.journal_entries = JournalEntries(ns_client)
  File "/usr/local/lib/python3.7/site-packages/netsuitesdk/api/journal_entries.py", line 32, in __init__
    self.class_ = getattr(ns_client, self.class_name)
AttributeError: 'NetSuiteClient' object has no attribute 'JournalEntry'

@mroy-seedbox
Copy link
Contributor

@mroy-seedbox mroy-seedbox commented on 634015d Feb 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thank you! 🙏

It's not immediately obvious that the code is being used/inherited in that other class (AdvInterCompanyJournalEntries), so it might be worth it to add a comment.

@ashwin1111
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mroy-seedbox this change is reverted, latest changes are available in version 2.16.5

@mroy-seedbox
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!! 🙏

Please sign in to comment.