-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for POST of Vendors and Employees (#42)
Support for POST of Vendors and Employees
- Loading branch information
Showing
4 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,45 @@ | ||
from collections import OrderedDict | ||
|
||
from .base import ApiBase | ||
import logging | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class Vendors(ApiBase): | ||
def __init__(self, ns_client): | ||
ApiBase.__init__(self, ns_client=ns_client, type_name='Vendor') | ||
|
||
def post(self, data) -> OrderedDict: | ||
assert data['externalId'], 'missing external id' | ||
vendor = self.ns_client.Vendor(externalId=data['externalId']) | ||
|
||
vendor['currency'] = self.ns_client.RecordRef(**(data['currency'])) | ||
|
||
vendor['subsidiary'] = self.ns_client.RecordRef(**(data['subsidiary'])) | ||
|
||
vendor['representingSubsidiary'] = self.ns_client.RecordRef(**(data['representingSubsidiary'])) | ||
|
||
vendor['workCalendar'] = self.ns_client.RecordRef(**(data['workCalendar'])) | ||
|
||
if 'entityId' in data: | ||
vendor['entityId'] = data['entityId'] | ||
|
||
if 'isPerson' in data: | ||
vendor['isPerson'] = data['isPerson'] | ||
|
||
if 'companyName' in data: | ||
vendor['companyName'] = data['companyName'] | ||
|
||
if 'firstName' in data: | ||
vendor['firstName'] = data['firstName'] | ||
|
||
if 'lastName' in data: | ||
vendor['lastName'] = data['lastName'] | ||
|
||
if 'email' in data: | ||
vendor['email'] = data['email'] | ||
|
||
logger.debug('able to create vendor = %s', vendor) | ||
res = self.ns_client.upsert(vendor) | ||
return self._serialize(res) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
setuptools.setup( | ||
name='netsuitesdk', | ||
version='1.14.0', | ||
version='1.15.0', | ||
author='Siva Narayanan', | ||
author_email='[email protected]', | ||
description='Python SDK for accessing the NetSuite SOAP webservice', | ||
|