odoo/dev/scripts/create_product.py

36 lines
678 B
Python

# -*- coding: utf-8 -*-
import odoorpc
host = 'localhost'
port = 8080
db = 'tz-austria_1'
user = 'admin'
pw = 'x'
odoo = odoorpc.ODOO(host, port=port)
odoo.login(db, user, pw)
values = {
"default_code": "02",
"name": "Produktname",
"length": 45.01,
"width": 13.45,
"thickness": 33.44,
"surface": "m",
"weight": 80.45,
"is_interneal": True,
"xcat_id": "xcat_1",
"notes": "notes",
"material_type_id": "material_1",
"intrastat_id": "Code",
"sale_ok": True,
"assembly_line_ids": ["L1", "L2"],
"list_price": 50.00
}
product_obj = odoo.env['product.template']
result = product_obj.create_product(values)
print(result)