Skip to content
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
fishbowl.log
fishbowl/fishbowl.ini

fishbowl_api.egg-info
3 changes: 2 additions & 1 deletion fishbowl/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,9 @@ def get_so(self, number):
def save_so(self, so):
request = xmlrequests.SaveSO(so, key=self.key)
response = self.send_message(request)
# print etree.tostring(response)
check_status(response.find('FbiMsgsRs'))
return objects.SalesOrder(response.find('SalesOrder'))
return objects.SalesOrder(response.find('.//SalesOrder'))


class FishbowlAPI(object):
Expand Down
8 changes: 7 additions & 1 deletion fishbowl/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def get_xml_data(self, base_el):
if six.PY2:
key = key.encode(self.encoding)
if children:
if [el for el in child if el.text.strip()]:
if [el for el in child if el.text and el.text.strip()]:
data[key] = self.get_xml_data(child)
else:
inner = []
Expand All @@ -167,8 +167,13 @@ def __setitem__(self, key, value):
raise KeyError('No field named {}'.format(key))
expected_type = self.fields[key]
expected_type = getattr(expected_type, 'type', expected_type)

if expected_type is None:
expected_type = six.text_type

if not inspect.isclass(expected_type):
expected_type = expected_type.__class__

if not isinstance(value, expected_type):
raise ValueError('Value was not type {}'.format(expected_type))
self.mapped[key] = value
Expand Down Expand Up @@ -414,6 +419,7 @@ class SalesOrderItem(FishbowlObject):
('RevisionLevel', int),
('TotalCost', decimal.Decimal),
('TaxableFlag', fishbowl_boolean),
('Note', None)
])


Expand Down