Showing posts with label xmlrpc openerp. Show all posts
Showing posts with label xmlrpc openerp. Show all posts

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.

How to use xmlrpc using Python older version


Integration with Odoo using XMLRPC Older 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/object".format(url), allow_none=True)

#Call specific API
print common.execute(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.