50 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
| # -*- coding: utf-8 -*-
 | |
| import odoorpc
 | |
| 
 | |
| host = 'localhost'
 | |
| port = 8080
 | |
| db = 'tz-austria_1'
 | |
| user = 'tz-admin'
 | |
| pw = 'x'
 | |
| 
 | |
| # host = 'erp.tzaustria.info'
 | |
| # port = 443
 | |
| # db = 'odoo-test'
 | |
| # user = 'tz-admin'
 | |
| # pw = '12tza345'
 | |
| # protocol="jsonrpc+ssl"
 | |
| 
 | |
| odoo = odoorpc.ODOO(host, port=port)
 | |
| # odoo = odoorpc.ODOO(host, protocol=protocol, port=port)
 | |
| odoo.login(db, user, pw)
 | |
| 
 | |
| values = {
 | |
|     "default_code": "TESTAAAA",
 | |
|     "name": "Produktname",
 | |
|     "length": 45.01,
 | |
|     "width": 13.45,
 | |
|     "thickness": 33.44,
 | |
|     "height": 88.37,
 | |
|     "surface": "m",
 | |
|     "weight": 80.45,
 | |
|     "active": True,
 | |
|     "is_internal": True,
 | |
|     "xcat_id": "XCategory Name",
 | |
|     "notes": "notes",
 | |
|     "material_type_id": "Roh Material",
 | |
|     "categ_id": "__connector",
 | |
|     "intrastat_id": "34052000",
 | |
|     "sale_ok": True,
 | |
|     "assembly_line_ids": ["0000"],
 | |
|     "list_price": 50.00,
 | |
|     "can_be_sold_unconfigured": True,
 | |
|     "image": "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
 | |
|     "tax": "20% MwSt.",# oder "10% MwSt.", "0% MwSt."
 | |
| }
 | |
| 
 | |
| product_obj = odoo.env['product.template']
 | |
| 
 | |
| result = product_obj.create_product(values)
 | |
| 
 | |
| print(result)
 |