-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample_script.py
More file actions
40 lines (29 loc) · 822 Bytes
/
sample_script.py
File metadata and controls
40 lines (29 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
Moving tasks of a project from one stage to another
"""
import xmlrpc.client
# ======================================
# CHANGE THE CONSTANTS HERE ACCORDINGLY
# ======================================
url = "http://localhost:8069"
db = "training"
username, password = 'admin', 'admin'
def authentication():
common = xmlrpc.client.ServerProxy(url + "/xmlrpc/2/common")
return common.authenticate(db, username, password, {})
uid = authentication()
# USAGES
models = xmlrpc.client.ServerProxy(url + "/xmlrpc/2/object")
def _rpc(*args):
# shorthand for running xmlrpc requests
return models.execute_kw(db, uid, password,
*args)
# SCRIPT START
_rpc(
"car.car", "create",
[{
"name": "Phantom",
"brand": "Rolls Royce",
"miles": 0
}]
)