Created
July 22, 2019 09:22
-
-
Save WeeDom/73e465d779a1e454cd6a8f85addb774b to your computer and use it in GitHub Desktop.
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
#get user ID | |
logger.debug('Logging into ' + commonUrl) | |
try: | |
sock_common = client.ServerProxy(commonUrl) | |
logger.debug("dbname: {}, user: {}, pass: {}".format(dbname,username,pwd)) | |
uid = sock_common.login(dbname, username, pwd) | |
except ConnectionRefusedError: | |
msg = "Connection was refused to: {}".format(commonUrl) | |
logger.error(msg) | |
exit(1) | |
else: | |
msg = "Successfully connected with user ID {}".format(uid) | |
logger.debug(msg) | |
#create order | |
sock = client.ServerProxy(config['url']['object']) | |
resource = 'sale.order' | |
action = 'create' | |
sale_order_id = sock.execute(dbname, uid, pwd, resource, action, payload) | |
#insert newly created order's name (reference within odoo) | |
action = 'read' | |
response = sock.execute(dbname, uid, pwd, resource, action, sale_order_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment