75 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			75 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
| #!/usr/bin/env python
 | |
| # -*- coding: utf-8 -*-
 | |
| import odoorpc
 | |
| import config
 | |
| 
 | |
| c = config.Config()
 | |
| 
 | |
| 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, protocol=protocol, port=port)
 | |
| odoo = odoorpc.ODOO(host, port=port)
 | |
| odoo.login(db, user, pw)
 | |
| 
 | |
| values = {
 | |
|     "origin": "",
 | |
|     "client_order_ref": "",
 | |
|     "note": "note",
 | |
|     "date_order": "2017-11-21",
 | |
|     "assembled": True,
 | |
|     "line_id": "0000",
 | |
|     "confirm_order": True,
 | |
|     "order_type": "D",
 | |
|     'confirmation_nr': 'FR000001',
 | |
|     "portal_id": "59-0001",
 | |
|     "portal_delivery_id": "111112",
 | |
|     "delivery_firstname": "Huber",
 | |
|     "delivery_lastname": "Bauer",
 | |
|     "delivery_midname": False,
 | |
|     "delivery_street": "Zeilergasse 7-11",
 | |
|     "delivery_street2": False,
 | |
|     "delivery_zip": "1170",
 | |
|     "delivery_city": "Wien",
 | |
|     "delivery_country_id": "AT",
 | |
|     "delivery_fax": False,
 | |
|     "delivery_phone": False,
 | |
|     "delivery_mobile": "+43 676 5556705",
 | |
|     "attachment_ids": [{
 | |
|         "filename": "logo.png",
 | |
|         "binary": c.test_image,
 | |
|     }],
 | |
|     "order_lines": [{
 | |
|         "name": "Beschreibung der Zeile",
 | |
|         "product_id": "MEL_MDFB180_KR0876_000000",
 | |
|         "price_unit": 50.00,
 | |
|         "product_uom_qty": 4.0,
 | |
|         "lot_id": {
 | |
|             "name": "AAA012345681",
 | |
|             "weight": 5.5,
 | |
|             "notes": "notes",
 | |
|             "attachment_ids": [{
 | |
|                 "filename": "logo.gif",
 | |
|                 "binary": "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
 | |
|             }],
 | |
|             "image": c.test_image,
 | |
|         }
 | |
|     }]
 | |
| }
 | |
| 
 | |
| sale_order_obj = odoo.env['sale.order']
 | |
| 
 | |
| result = sale_order_obj.pg_create_quotation(values)
 | |
| 
 | |
| print(result)
 |