Monday, November 19, 2018

How to use xmlrpc using Python for new verion


Integration with Odoo using XMLRPC New Version.




#Step1 Add library
import xmlrpclib

#Step2 Add Variables
url="http://YourIP/DomainName:PortNumber"
db = "v2"
username = "admin"
password = "admin"

#Call to server
common = xmlrpclib.ServerProxy("{}/xmlrpc/common".format(url), allow_none=True)
uid = common.login(db, username, password)
common = xmlrpclib.ServerProxy("{}/xmlrpc/2/object".format(url), allow_none=True)

#Call specific API
print common.execute_kw(db, uid, password, "Model.Name", "Model.Method.Name", "YourPayload", "ContextIncaseNeedToPass")


Add xmlrpc library in case didn't install in your server click here to download and install.

No comments:

Post a Comment

If you have any query please comment here, Will get back to you :)