Hello,
I am trying to create products in Odoo using the API (XML-RPC). While I am able to successfully create a product and its various parameters in Odoo, I am still not able to map a product attribute-value pair to a product.
I am writing the code in Python language.
Below is the code:
import xmlrpc.client
from itertools import product
url = "************"
db = "************"
username = '***************'
password = "***************"
common = xmlrpc.client.ServerProxy('{}/xmlrpc/2/common'.format(url))
print(common.version())
uid = common.authenticate(db, username, password, {})
models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))
id = models.execute_kw(db, uid, password, 'product.template', 'create', [{
'name': "Attribute Testing123",
'default_code': "Attribute Test 123",
'active': "TRUE",
'display_name': 'My New Product Testing',
'detailed_type': 'product',
'list_price': '89962',
'image_1920':'https://adamimages.sbdinc.com/GEM/Dewalt/1000x1000_72r/DCD785M2_1.jpg'
'categ_id': "25",
'attribute_id': "29939"
'value_ids': [(6,0,[])]
}])
Please can someone provide with the correct solution?