Odoo External API – Create records | XMLRPC | How to Create Records – CBMS Odoo ERP

Odoo External API – Create records | XMLRPC | How to Create Records – CBMS Odoo ERP

0 minutes, 38 seconds Read

Records of a model are created using create(). The method will create a single record and return its database identifier. create() takes a mapping of fields to values, used to initialize the record. For any field which has a default value and is not set through the mapping argument, the default value will be used.

url = ”
db = ‘test_local_enterprise_db’
username = ’14’
password = ’14’

import xmlrpc.client
common = xmlrpc.client.ServerProxy(‘{}/xmlrpc/2/common’.format(url))
version = common.version()
print(“version”, version)
uid = common.authenticate(db, username, password, {})
print(“uid = “,uid)
models = xmlrpc.client.ServerProxy(‘{}/xmlrpc/2/object’.format(url))
id = models.execute_kw(db, uid, password, ‘res.partner’, ‘create’, [{‘name’: “demo”,}])
print(“newly created record”,id)

#Odoo #External #API #Create #records #XMLRPC #Create #Records

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *