11
.. i18n: Working with Web Services
12
.. i18n: =========================
15
Working with Web Services
16
=========================
18
.. i18n: Given the architecture of OpenERP, it is not possible to reliably access the
19
.. i18n: database with the PostgreSQL client or through a direct connection method
20
.. i18n: such as ODBC.
21
.. i18n: Fortunately, OpenERP provides a very comprehensive set of web services that
22
.. i18n: allow you to do everything through standard protocols.
25
Given the architecture of OpenERP, it is not possible to reliably access the
26
database with the PostgreSQL client or through a direct connection method
28
Fortunately, OpenERP provides a very comprehensive set of web services that
29
allow you to do everything through standard protocols.
32
.. i18n: Though it is technically possible, you must be aware that this can have
33
.. i18n: disastrous consequences for your data, unless you know exactly what you are
34
.. i18n: doing. You are advised to shut down the OpenERP server when accessing the
35
.. i18n: database to avoid caching and concurrency issues.
39
Though it is technically possible, you must be aware that this can have
40
disastrous consequences for your data, unless you know exactly what you are
41
doing. You are advised to shut down the OpenERP server when accessing the
42
database to avoid caching and concurrency issues.
44
.. i18n: Supported Web Services Protocols
45
.. i18n: --------------------------------
46
.. i18n: The currently supported protocols are XML-RPC and Net-RPC. XML-RPC is one of the
47
.. i18n: first standard for web services, and can be used in almost any language.
48
.. i18n: It is a pretty verbose protocol, which may sometimes introduce a bit of latency.
49
.. i18n: Net-RPC, on the other hand, is an optimized protocol particularly designed for
50
.. i18n: use between applications written in Python.
53
Supported Web Services Protocols
54
--------------------------------
55
The currently supported protocols are XML-RPC and Net-RPC. XML-RPC is one of the
56
first standard for web services, and can be used in almost any language.
57
It is a pretty verbose protocol, which may sometimes introduce a bit of latency.
58
Net-RPC, on the other hand, is an optimized protocol particularly designed for
59
use between applications written in Python.
61
.. i18n: Support for REST-style webservices is planned for future releases of OpenERP.
64
Support for REST-style webservices is planned for future releases of OpenERP.
66
.. i18n: Support for the SOAP protocol is deprecated at the moment, but could maybe be
67
.. i18n: revived if sufficient interest is found in the community.
70
Support for the SOAP protocol is deprecated at the moment, but could maybe be
71
revived if sufficient interest is found in the community.
73
.. i18n: Available Web Services
74
.. i18n: ----------------------
75
.. i18n: The OpenERP server provides you with the following web services.
78
Available Web Services
79
----------------------
80
The OpenERP server provides you with the following web services.
83
.. i18n: You may find out the details of each service in the corresponding class
84
.. i18n: in the server sources, in bin/service/web_services.py .
88
You may find out the details of each service in the corresponding class
89
in the server sources, in bin/service/web_services.py .
92
.. i18n: Provides functions to create, drop, backup and restore databases.
93
.. i18n: Use with caution!
97
Provides functions to create, drop, backup and restore databases.
101
.. i18n: Lets you log in and out of OpenERP, and provides various utility functions. You
102
.. i18n: will need to call the function "login" before you can use most of the other
103
.. i18n: web services.
107
Lets you log in and out of OpenERP, and provides various utility functions. You
108
will need to call the function "login" before you can use most of the other
112
.. i18n: The most useful web service, as it provides access to the OpenERP Objects.
113
.. i18n: Most notably, the function "execute" lets you call methods of the Objects, such
114
.. i18n: as moste of the ORM methods to search, read and write records. It can also be
115
.. i18n: used to call any other method of the object, such as computing a price for
120
The most useful web service, as it provides access to the OpenERP Objects.
121
Most notably, the function "execute" lets you call methods of the Objects, such
122
as moste of the ORM methods to search, read and write records. It can also be
123
used to call any other method of the object, such as computing a price for
127
.. i18n: Here is a quick reminder of the main ORM methods:
129
.. i18n: create({'field':'value'})
130
.. i18n: * Creates a new record with the specified value
131
.. i18n: * Returns: id of the new record
133
.. i18n: search([('arg1','=','value1')...], offset=0, limit=1000)
134
.. i18n: * arg1, arg2, .. ,argN: list of tuples specifying search criteria
135
.. i18n: * offset: optional number of records to skip
136
.. i18n: * limit: optional max number of records to return
137
.. i18n: * Returns: list of IDS of records matching the given criteria
139
.. i18n: read([IDS], ['field1','field2',...])
140
.. i18n: * fields: optional list of field names to return (default: all fields)
141
.. i18n: * Returns: the id of each record and the values of the requested field
143
.. i18n: write([IDS], {'field1':'value1','field2':3})
144
.. i18n: * values: dictionary of field values to update
145
.. i18n: * Updates records with given ids with the given values
146
.. i18n: * Returns: True
148
.. i18n: unlink([IDS])
149
.. i18n: * Deletes records with the given ids
150
.. i18n: * Returns: True
152
.. i18n: browse() can't be used through web services.
156
Here is a quick reminder of the main ORM methods:
158
create({'field':'value'})
159
* Creates a new record with the specified value
160
* Returns: id of the new record
162
search([('arg1','=','value1')...], offset=0, limit=1000)
163
* arg1, arg2, .. ,argN: list of tuples specifying search criteria
164
* offset: optional number of records to skip
165
* limit: optional max number of records to return
166
* Returns: list of IDS of records matching the given criteria
168
read([IDS], ['field1','field2',...])
169
* fields: optional list of field names to return (default: all fields)
170
* Returns: the id of each record and the values of the requested field
172
write([IDS], {'field1':'value1','field2':3})
173
* values: dictionary of field values to update
174
* Updates records with given ids with the given values
178
* Deletes records with the given ids
181
browse() can't be used through web services.
183
.. i18n: Another useful function is "exec_workflow", which lets you make a record
184
.. i18n: progress through a workflow.
187
Another useful function is "exec_workflow", which lets you make a record
188
progress through a workflow.
195
.. i18n: Provides access to the old-style wizards. Please note that the new-style wizards
196
.. i18n: are based on the ORM, and as such they can be accessed though the "object" web
200
Provides access to the old-style wizards. Please note that the new-style wizards
201
are based on the ORM, and as such they can be accessed though the "object" web
209
.. i18n: Lets you generate and retrieve reports.
212
Lets you generate and retrieve reports.
214
.. i18n: Example : writing data through the Web Services
215
.. i18n: -----------------------------------------------
218
Example : writing data through the Web Services
219
-----------------------------------------------
221
.. i18n: Here is an example process that you could follow to write data. You will find
222
.. i18n: more detailed examples for XML-RPC in various programming languages in the next
226
Here is an example process that you could follow to write data. You will find
227
more detailed examples for XML-RPC in various programming languages in the next
230
.. i18n: #. login: call "login" in the web service "common" with the following
237
.. i18n: #. create a new partner: call "execute" in the web service "object" with the
238
.. i18n: following parameters:
241
.. i18n: * user id provided by "login" in step 1.
242
.. i18n: * the object name : 'res.partner'
243
.. i18n: * the name of the ORM method : "create"
244
.. i18n: * some data to be recorded
247
#. login: call "login" in the web service "common" with the following
254
#. create a new partner: call "execute" in the web service "object" with the
255
following parameters:
258
* user id provided by "login" in step 1.
259
* the object name : 'res.partner'
260
* the name of the ORM method : "create"
261
* some data to be recorded
263
.. i18n: The data mentioned above is a dictionary of keys and values, for example:
266
The data mentioned above is a dictionary of keys and values, for example:
268
.. i18n: * name: Fabien Pinckaers
269
.. i18n: * lang: fr_FR
272
* name: Fabien Pinckaers
275
.. i18n: But more complex data structures can also be sent - for example you could record
276
.. i18n: a partner and their addresses, all in a single call to the web service.
277
.. i18n: In that case, all the data is processed by the server during the same
278
.. i18n: database transaction - meaning you are sure to keep a consistent state for
279
.. i18n: your data - a critical requirement for all ERP applications.
282
But more complex data structures can also be sent - for example you could record
283
a partner and their addresses, all in a single call to the web service.
284
In that case, all the data is processed by the server during the same
285
database transaction - meaning you are sure to keep a consistent state for
286
your data - a critical requirement for all ERP applications.
288
.. i18n: XML-RPC Web services
289
.. i18n: ====================
295
.. i18n: XML-RPC is known as a web service. Web services are a set of tools that let one build distributed applications on top of existing web infrastructures. These applications use the Web as a kind of "transport layer" but don't offer a direct human interface via the browser.[1] Extensible Markup Language (XML) provides a vocabulary for describing Remote Procedure Calls (RPC), which is then transmitted between computers using the HyperText Transfer Protocol (HTTP). Effectively, RPC gives developers a mechanism for defining interfaces that can be called over a network. These interfaces can be as simple as a single function call or as complex as a large API.
298
XML-RPC is known as a web service. Web services are a set of tools that let one build distributed applications on top of existing web infrastructures. These applications use the Web as a kind of "transport layer" but don't offer a direct human interface via the browser.[1] Extensible Markup Language (XML) provides a vocabulary for describing Remote Procedure Calls (RPC), which is then transmitted between computers using the HyperText Transfer Protocol (HTTP). Effectively, RPC gives developers a mechanism for defining interfaces that can be called over a network. These interfaces can be as simple as a single function call or as complex as a large API.
300
.. i18n: XML-RPC therefore allows two or more computers running different operating systems and programs written in different languages to share processing. For example, a Java application could talk with a Perl program, which in turn talks with Python application that talks with ASP, and so on. System integrators often build custom connections between different systems, creating their own formats and protocols to make communications possible, but one can often end up with a large number of poorly documented single-use protocols. The RPC approach spares programmers the trouble of having to learn about underlying protocols, networking, and various implementation details.
303
XML-RPC therefore allows two or more computers running different operating systems and programs written in different languages to share processing. For example, a Java application could talk with a Perl program, which in turn talks with Python application that talks with ASP, and so on. System integrators often build custom connections between different systems, creating their own formats and protocols to make communications possible, but one can often end up with a large number of poorly documented single-use protocols. The RPC approach spares programmers the trouble of having to learn about underlying protocols, networking, and various implementation details.
305
.. i18n: XML-RPC can be used with Python, Java, Perl, PHP, C, C++, Ruby, Microsoft’s .NET and many other programming languages. Implementations are widely available for platforms such as Unix, Linux, Windows and the Macintosh.
308
XML-RPC can be used with Python, Java, Perl, PHP, C, C++, Ruby, Microsoft’s .NET and many other programming languages. Implementations are widely available for platforms such as Unix, Linux, Windows and the Macintosh.
310
.. i18n: An XML-RPC call is conducted between two parties: the client (the calling process) and the server (the called process). A server is made available at a particular URL (such as http://example.org:8080/rpcserv/).
313
An XML-RPC call is conducted between two parties: the client (the calling process) and the server (the called process). A server is made available at a particular URL (such as http://example.org:8080/rpcserv/).
315
.. i18n: The above text just touches the surface of XML-RPC. I recommend O'Reilly's "Programming Web Service with XML-RPC" for further reading. One may also wish to review the following links:
318
The above text just touches the surface of XML-RPC. I recommend O'Reilly's "Programming Web Service with XML-RPC" for further reading. One may also wish to review the following links:
334
.. i18n: XML-RPC Architecture
335
.. i18n: """"""""""""""""""""
341
.. i18n: OpenERP is a based on a client/server architecture. The server and the client(s) communicate using the XML-RPC protocol. XML-RPC is a very simple protocol which allows the client to do remote procedure calls. The called function, its arguments, and the result of the call are transported using HTTP and encoded using XML. For more information on XML-RPC, please see: http://www.xml-rpc.com.
344
OpenERP is a based on a client/server architecture. The server and the client(s) communicate using the XML-RPC protocol. XML-RPC is a very simple protocol which allows the client to do remote procedure calls. The called function, its arguments, and the result of the call are transported using HTTP and encoded using XML. For more information on XML-RPC, please see: http://www.xml-rpc.com.
346
.. i18n: Architecture
347
.. i18n: """"""""""""
353
.. i18n: The diagram below synthesizes the client server architecture of OpenERP. OpenERP server and OpenERP clients communicate using XML-RPC.
356
The diagram below synthesizes the client server architecture of OpenERP. OpenERP server and OpenERP clients communicate using XML-RPC.
358
.. i18n: .. figure:: images/tech_arch.png
360
.. i18n: :align: center
363
.. figure:: images/tech_arch.png
372
.. i18n: The logic of OpenERP is configured on the server side. The client is very simple; it is only used to post data (forms, lists, trees) and to send back the result to the server. The updates and the addition of new functionality don't need the clients to be frequently upgraded. This makes OpenERP easier to maintain.
375
The logic of OpenERP is configured on the server side. The client is very simple; it is only used to post data (forms, lists, trees) and to send back the result to the server. The updates and the addition of new functionality don't need the clients to be frequently upgraded. This makes OpenERP easier to maintain.
377
.. i18n: The client doesn't understand what it posts. Even actions like 'Click on the print icon' are sent to the server to ask how to react.
380
The client doesn't understand what it posts. Even actions like 'Click on the print icon' are sent to the server to ask how to react.
382
.. i18n: The client operation is very simple; when a user makes an action (save a form, open a menu, print, ...) it sends this action to the server. The server then sends the new action to execute to the client.
385
The client operation is very simple; when a user makes an action (save a form, open a menu, print, ...) it sends this action to the server. The server then sends the new action to execute to the client.
387
.. i18n: There are three types of action;
390
There are three types of action;
392
.. i18n: * Open a window (form or tree)
393
.. i18n: * Print a document
394
.. i18n: * Execute a wizard
397
* Open a window (form or tree)
408
.. i18n: Access tiny-server using xml-rpc
409
.. i18n: """"""""""""""""""""""""""""""""
412
Access tiny-server using xml-rpc
413
""""""""""""""""""""""""""""""""
422
.. i18n: * **Create a partner and their address**
425
* **Create a partner and their address**
429
.. i18n: import xmlrpclib
431
.. i18n: username = 'admin' #the user
432
.. i18n: pwd = 'admin' #the password of the user
433
.. i18n: dbname = 'terp' #the database
435
.. i18n: # Get the uid
436
.. i18n: sock_common = xmlrpclib.ServerProxy ('http://localhost:8069/xmlrpc/common')
437
.. i18n: uid = sock_common.login(dbname, username, pwd)
439
.. i18n: #replace localhost with the address of the server
440
.. i18n: sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
443
.. i18n: 'name': 'Fabien Pinckaers',
444
.. i18n: 'lang': 'fr_FR',
447
.. i18n: partner_id = sock.execute(dbname, uid, pwd, 'res.partner', 'create', partner)
450
.. i18n: 'partner_id': partner_id,
451
.. i18n: 'type' : 'default',
452
.. i18n: 'street': 'Chaussée de Namur 40',
453
.. i18n: 'zip': '1367',
454
.. i18n: 'city': 'Grand-Rosière',
455
.. i18n: 'phone': '+3281813700',
456
.. i18n: 'fax': '+3281733501',
459
.. i18n: address_id = sock.execute(dbname, uid, pwd, 'res.partner.address', 'create', address)
466
username = 'admin' #the user
467
pwd = 'admin' #the password of the user
468
dbname = 'terp' #the database
471
sock_common = xmlrpclib.ServerProxy ('http://localhost:8069/xmlrpc/common')
472
uid = sock_common.login(dbname, username, pwd)
474
#replace localhost with the address of the server
475
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
478
'name': 'Fabien Pinckaers',
482
partner_id = sock.execute(dbname, uid, pwd, 'res.partner', 'create', partner)
485
'partner_id': partner_id,
487
'street': 'Chaussée de Namur 40',
489
'city': 'Grand-Rosière',
490
'phone': '+3281813700',
491
'fax': '+3281733501',
494
address_id = sock.execute(dbname, uid, pwd, 'res.partner.address', 'create', address)
496
.. i18n: * **Search a partner**
499
.. i18n: args = [('vat', '=', 'ZZZZZZ')] #query clause
500
.. i18n: ids = sock.execute(dbname, uid, pwd, 'res.partner', 'search', args)
502
.. i18n: * **Read partner data**
505
.. i18n: fields = ['name', 'active', 'vat', 'ref'] #fields to read
506
.. i18n: data = sock.execute(dbname, uid, pwd, 'res.partner', 'read', ids, fields) #ids is a list of id
508
.. i18n: * **Update partner data**
511
.. i18n: values = {'vat': 'ZZ1ZZZ'} #data to update
512
.. i18n: result = sock.execute(dbname, uid, pwd, 'res.partner', 'write', ids, values)
514
.. i18n: * **Delete partner**
517
.. i18n: # ids : list of id
518
.. i18n: result = sock.execute(dbname, uid, pwd, 'res.partner', 'unlink', ids)
521
* **Search a partner**
524
args = [('vat', '=', 'ZZZZZZ')] #query clause
525
ids = sock.execute(dbname, uid, pwd, 'res.partner', 'search', args)
527
* **Read partner data**
530
fields = ['name', 'active', 'vat', 'ref'] #fields to read
531
data = sock.execute(dbname, uid, pwd, 'res.partner', 'read', ids, fields) #ids is a list of id
533
* **Update partner data**
536
values = {'vat': 'ZZ1ZZZ'} #data to update
537
result = sock.execute(dbname, uid, pwd, 'res.partner', 'write', ids, values)
543
result = sock.execute(dbname, uid, pwd, 'res.partner', 'unlink', ids)
552
.. i18n: Access Open-server using xml-rpc
553
.. i18n: """"""""""""""""""""""""""""""""
556
Access Open-server using xml-rpc
557
""""""""""""""""""""""""""""""""
559
.. i18n: **Download the XML-RPC framework for PHP**
562
**Download the XML-RPC framework for PHP**
564
.. i18n: windows / linux: download the xml-rpc framework for php from http://phpxmlrpc.sourceforge.net/ The latest stable release is version 2.2 released on February 25, 2007
567
windows / linux: download the xml-rpc framework for php from http://phpxmlrpc.sourceforge.net/ The latest stable release is version 2.2 released on February 25, 2007
569
.. i18n: **Setup the XML-RPC for PHP**
572
**Setup the XML-RPC for PHP**
574
.. i18n: extract file xmlrpc-2.2.tar.gz and take the file xmlrpc.inc from lib directory place the xmlrpc.inc in the php library folder restart the apache/iis server
577
extract file xmlrpc-2.2.tar.gz and take the file xmlrpc.inc from lib directory place the xmlrpc.inc in the php library folder restart the apache/iis server
579
.. i18n: **Demo script**
589
.. i18n: .. code-block:: php
591
.. i18n: function connect() {
592
.. i18n: var $user = 'admin';
593
.. i18n: var $password = 'admin';
594
.. i18n: var $dbname = 'db_name';
595
.. i18n: var $server_url = 'http://localhost:8069/xmlrpc/';
597
.. i18n: if(isset($_COOKIE["user_id"]) == true) {
598
.. i18n: if($_COOKIE["user_id"]>0) {
599
.. i18n: return $_COOKIE["user_id"];
603
.. i18n: $sock = new xmlrpc_client($server_url.'common');
604
.. i18n: $msg = new xmlrpcmsg('login');
605
.. i18n: $msg->addParam(new xmlrpcval($dbname, "string"));
606
.. i18n: $msg->addParam(new xmlrpcval($user, "string"));
607
.. i18n: $msg->addParam(new xmlrpcval($password, "string"));
608
.. i18n: $resp = $sock->send($msg);
609
.. i18n: $val = $resp->value();
610
.. i18n: $id = $val->scalarval();
611
.. i18n: setcookie("user_id",$id,time()+3600);
612
.. i18n: if($id > 0) {
624
var $password = 'admin';
625
var $dbname = 'db_name';
626
var $server_url = 'http://localhost:8069/xmlrpc/';
628
if(isset($_COOKIE["user_id"]) == true) {
629
if($_COOKIE["user_id"]>0) {
630
return $_COOKIE["user_id"];
634
$sock = new xmlrpc_client($server_url.'common');
635
$msg = new xmlrpcmsg('login');
636
$msg->addParam(new xmlrpcval($dbname, "string"));
637
$msg->addParam(new xmlrpcval($user, "string"));
638
$msg->addParam(new xmlrpcval($password, "string"));
639
$resp = $sock->send($msg);
640
$val = $resp->value();
641
$id = $val->scalarval();
642
setcookie("user_id",$id,time()+3600);
650
.. i18n: * **Search**
655
.. i18n: .. code-block:: php
658
.. i18n: * $client = xml-rpc handler
659
.. i18n: * $relation = name of the relation ex: res.partner
660
.. i18n: * $attribute = name of the attribute ex:code
661
.. i18n: * $operator = search term operator ex: ilike, =, !=
662
.. i18n: * $key=search for
665
.. i18n: function search($client,$relation,$attribute,$operator,$keys) {
666
.. i18n: var $user = 'admin';
667
.. i18n: var $password = 'admin';
668
.. i18n: var $userId = -1;
669
.. i18n: var $dbname = 'db_name';
670
.. i18n: var $server_url = 'http://localhost:8069/xmlrpc/';
672
.. i18n: $key = array(new xmlrpcval(array(new xmlrpcval($attribute , "string"),
673
.. i18n: new xmlrpcval($operator,"string"),
674
.. i18n: new xmlrpcval($keys,"string")),"array"),
677
.. i18n: if($userId<=0) {
681
.. i18n: $msg = new xmlrpcmsg('execute');
682
.. i18n: $msg->addParam(new xmlrpcval($dbname, "string"));
683
.. i18n: $msg->addParam(new xmlrpcval($userId, "int"));
684
.. i18n: $msg->addParam(new xmlrpcval($password, "string"));
685
.. i18n: $msg->addParam(new xmlrpcval($relation, "string"));
686
.. i18n: $msg->addParam(new xmlrpcval("search", "string"));
687
.. i18n: $msg->addParam(new xmlrpcval($key, "array"));
689
.. i18n: $resp = $client->send($msg);
690
.. i18n: $val = $resp->value();
691
.. i18n: $ids = $val->scalarval();
693
.. i18n: return $ids;
700
* $client = xml-rpc handler
701
* $relation = name of the relation ex: res.partner
702
* $attribute = name of the attribute ex:code
703
* $operator = search term operator ex: ilike, =, !=
707
function search($client,$relation,$attribute,$operator,$keys) {
709
var $password = 'admin';
711
var $dbname = 'db_name';
712
var $server_url = 'http://localhost:8069/xmlrpc/';
714
$key = array(new xmlrpcval(array(new xmlrpcval($attribute , "string"),
715
new xmlrpcval($operator,"string"),
716
new xmlrpcval($keys,"string")),"array"),
723
$msg = new xmlrpcmsg('execute');
724
$msg->addParam(new xmlrpcval($dbname, "string"));
725
$msg->addParam(new xmlrpcval($userId, "int"));
726
$msg->addParam(new xmlrpcval($password, "string"));
727
$msg->addParam(new xmlrpcval($relation, "string"));
728
$msg->addParam(new xmlrpcval("search", "string"));
729
$msg->addParam(new xmlrpcval($key, "array"));
731
$resp = $client->send($msg);
732
$val = $resp->value();
733
$ids = $val->scalarval();
738
.. i18n: * **Create**
743
.. i18n: .. code-block:: php
747
.. i18n: include('xmlrpc.inc');
749
.. i18n: $arrayVal = array(
750
.. i18n: 'name'=>new xmlrpcval('Fabien Pinckaers', "string") ,
751
.. i18n: 'vat'=>new xmlrpcval('BE477472701' , "string")
754
.. i18n: $client = new xmlrpc_client("http://localhost:8069/xmlrpc/object");
756
.. i18n: $msg = new xmlrpcmsg('execute');
757
.. i18n: $msg->addParam(new xmlrpcval("dbname", "string"));
758
.. i18n: $msg->addParam(new xmlrpcval("3", "int"));
759
.. i18n: $msg->addParam(new xmlrpcval("demo", "string"));
760
.. i18n: $msg->addParam(new xmlrpcval("res.partner", "string"));
761
.. i18n: $msg->addParam(new xmlrpcval("create", "string"));
762
.. i18n: $msg->addParam(new xmlrpcval($arrayVal, "struct"));
764
.. i18n: $resp = $client->send($msg);
766
.. i18n: if ($resp->faultCode())
768
.. i18n: echo 'Error: '.$resp->faultString();
772
.. i18n: echo 'Partner '.$resp->value()->scalarval().' created !';
781
include('xmlrpc.inc');
784
'name'=>new xmlrpcval('Fabien Pinckaers', "string") ,
785
'vat'=>new xmlrpcval('BE477472701' , "string")
788
$client = new xmlrpc_client("http://localhost:8069/xmlrpc/object");
790
$msg = new xmlrpcmsg('execute');
791
$msg->addParam(new xmlrpcval("dbname", "string"));
792
$msg->addParam(new xmlrpcval("3", "int"));
793
$msg->addParam(new xmlrpcval("demo", "string"));
794
$msg->addParam(new xmlrpcval("res.partner", "string"));
795
$msg->addParam(new xmlrpcval("create", "string"));
796
$msg->addParam(new xmlrpcval($arrayVal, "struct"));
798
$resp = $client->send($msg);
800
if ($resp->faultCode())
802
echo 'Error: '.$resp->faultString();
806
echo 'Partner '.$resp->value()->scalarval().' created !';
815
.. i18n: .. code-block:: php
818
.. i18n: * $client = xml-rpc handler
819
.. i18n: * $relation = name of the relation ex: res.partner
820
.. i18n: * $attribute = name of the attribute ex:code
821
.. i18n: * $operator = search term operator ex: ilike, =, !=
822
.. i18n: * $id = id of the record to be updated
823
.. i18n: * $data = data to be updated
826
.. i18n: function write($client,$relation,$attribute,$operator,$data,$id) {
827
.. i18n: var $user = 'admin';
828
.. i18n: var $password = 'admin';
829
.. i18n: var $userId = -1;
830
.. i18n: var $dbname = 'db_name';
831
.. i18n: var $server_url = 'http://localhost:8069/xmlrpc/';
833
.. i18n: $id_val = array();
834
.. i18n: $id_val[0] = new xmlrpcval($id, "int");
836
.. i18n: if($userId<=0) {
840
.. i18n: $msg = new xmlrpcmsg('execute');
841
.. i18n: $msg->addParam(new xmlrpcval($dbname, "string"));
842
.. i18n: $msg->addParam(new xmlrpcval($userId, "int"));
843
.. i18n: $msg->addParam(new xmlrpcval($password, "string"));
844
.. i18n: $msg->addParam(new xmlrpcval($relation, "string"));
845
.. i18n: $msg->addParam(new xmlrpcval("write", "string"));
846
.. i18n: $msg->addParam(new xmlrpcval($id, "array"));
847
.. i18n: $msg->addParam(new xmlrpcval($data, "struct"));
849
.. i18n: $resp = $client->send($msg);
850
.. i18n: $val = $resp->value();
851
.. i18n: $record = $val->scalarval();
853
.. i18n: return $record;
861
* $client = xml-rpc handler
862
* $relation = name of the relation ex: res.partner
863
* $attribute = name of the attribute ex:code
864
* $operator = search term operator ex: ilike, =, !=
865
* $id = id of the record to be updated
866
* $data = data to be updated
869
function write($client,$relation,$attribute,$operator,$data,$id) {
871
var $password = 'admin';
873
var $dbname = 'db_name';
874
var $server_url = 'http://localhost:8069/xmlrpc/';
877
$id_val[0] = new xmlrpcval($id, "int");
883
$msg = new xmlrpcmsg('execute');
884
$msg->addParam(new xmlrpcval($dbname, "string"));
885
$msg->addParam(new xmlrpcval($userId, "int"));
886
$msg->addParam(new xmlrpcval($password, "string"));
887
$msg->addParam(new xmlrpcval($relation, "string"));
888
$msg->addParam(new xmlrpcval("write", "string"));
889
$msg->addParam(new xmlrpcval($id, "array"));
890
$msg->addParam(new xmlrpcval($data, "struct"));
892
$resp = $client->send($msg);
893
$val = $resp->value();
894
$record = $val->scalarval();
907
.. i18n: Access Open-server using xml-rpc
908
.. i18n: """"""""""""""""""""""""""""""""
911
Access Open-server using xml-rpc
912
""""""""""""""""""""""""""""""""
914
.. i18n: **Download the apache XML-RPC framework for JAVA**
917
**Download the apache XML-RPC framework for JAVA**
919
.. i18n: Download the xml-rpc framework for java from http://ws.apache.org/xmlrpc/ The latest stable release is version 3.1 released on August 12, 2007.
920
.. i18n: All OpenERP errors throw exceptions because the framework allows only an int as the error code where OpenERP returns a string.
923
Download the xml-rpc framework for java from http://ws.apache.org/xmlrpc/ The latest stable release is version 3.1 released on August 12, 2007.
924
All OpenERP errors throw exceptions because the framework allows only an int as the error code where OpenERP returns a string.
926
.. i18n: **Demo script**
931
.. i18n: * **Find Databases**
936
.. i18n: .. code-block:: java
938
.. i18n: import java.net.URL;
939
.. i18n: import java.util.Vector;
941
.. i18n: import org.apache.commons.lang.StringUtils;
942
.. i18n: import org.apache.xmlrpc.XmlRpcException;
943
.. i18n: import org.apache.xmlrpc.client.XmlRpcClient;
944
.. i18n: import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
946
.. i18n: public Vector<String> getDatabaseList(String host, int port)
948
.. i18n: XmlRpcClient xmlrpcDb = new XmlRpcClient();
950
.. i18n: XmlRpcClientConfigImpl xmlrpcConfigDb = new XmlRpcClientConfigImpl();
951
.. i18n: xmlrpcConfigDb.setEnabledForExtensions(true);
952
.. i18n: xmlrpcConfigDb.setServerURL(new URL("http",host,port,"/xmlrpc/db"));
954
.. i18n: xmlrpcDb.setConfig(xmlrpcConfigDb);
957
.. i18n: //Retrieve databases
958
.. i18n: Vector<Object> params = new Vector<Object>();
959
.. i18n: Object result = xmlrpcDb.execute("list", params);
960
.. i18n: Object[] a = (Object[]) result;
962
.. i18n: Vector<String> res = new Vector<String>();
963
.. i18n: for (int i = 0; i < a.length; i++) {
964
.. i18n: if (a[i] instanceof String)
966
.. i18n: res.addElement((String)a[i]);
969
.. i18n: catch (XmlRpcException e) {
970
.. i18n: logger.warn("XmlException Error while retrieving OpenERP Databases: ",e);
973
.. i18n: catch (Exception e)
975
.. i18n: logger.warn("Error while retrieving OpenERP Databases: ",e);
984
import java.util.Vector;
986
import org.apache.commons.lang.StringUtils;
987
import org.apache.xmlrpc.XmlRpcException;
988
import org.apache.xmlrpc.client.XmlRpcClient;
989
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
991
public Vector<String> getDatabaseList(String host, int port)
993
XmlRpcClient xmlrpcDb = new XmlRpcClient();
995
XmlRpcClientConfigImpl xmlrpcConfigDb = new XmlRpcClientConfigImpl();
996
xmlrpcConfigDb.setEnabledForExtensions(true);
997
xmlrpcConfigDb.setServerURL(new URL("http",host,port,"/xmlrpc/db"));
999
xmlrpcDb.setConfig(xmlrpcConfigDb);
1002
//Retrieve databases
1003
Vector<Object> params = new Vector<Object>();
1004
Object result = xmlrpcDb.execute("list", params);
1005
Object[] a = (Object[]) result;
1007
Vector<String> res = new Vector<String>();
1008
for (int i = 0; i < a.length; i++) {
1009
if (a[i] instanceof String)
1011
res.addElement((String)a[i]);
1014
catch (XmlRpcException e) {
1015
logger.warn("XmlException Error while retrieving OpenERP Databases: ",e);
1020
logger.warn("Error while retrieving OpenERP Databases: ",e);
1025
.. i18n: * **Login**
1030
.. i18n: .. code-block:: java
1032
.. i18n: import java.net.URL;
1034
.. i18n: import org.apache.commons.lang.StringUtils;
1035
.. i18n: import org.apache.xmlrpc.XmlRpcException;
1036
.. i18n: import org.apache.xmlrpc.client.XmlRpcClient;
1037
.. i18n: import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
1039
.. i18n: public int Connect(String host, int port, String tinydb, String login, String password)
1041
.. i18n: XmlRpcClient xmlrpcLogin = new XmlRpcClient();
1043
.. i18n: XmlRpcClientConfigImpl xmlrpcConfigLogin = new XmlRpcClientConfigImpl();
1044
.. i18n: xmlrpcConfigLogin.setEnabledForExtensions(true);
1045
.. i18n: xmlrpcConfigLogin.setServerURL(new URL("http",host,port,"/xmlrpc/common"));
1047
.. i18n: xmlrpcLogin.setConfig(xmlrpcConfigLogin);
1051
.. i18n: params = new Object[] {tinydb,login,password};
1052
.. i18n: Object id = xmlrpcLogin.execute("login", params);
1053
.. i18n: if (id instanceof Integer)
1054
.. i18n: return (Integer)id;
1057
.. i18n: catch (XmlRpcException e) {
1058
.. i18n: logger.warn("XmlException Error while logging to OpenERP: ",e);
1061
.. i18n: catch (Exception e)
1063
.. i18n: logger.warn("Error while logging to OpenERP: ",e);
1069
.. code-block:: java
1071
import java.net.URL;
1073
import org.apache.commons.lang.StringUtils;
1074
import org.apache.xmlrpc.XmlRpcException;
1075
import org.apache.xmlrpc.client.XmlRpcClient;
1076
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
1078
public int Connect(String host, int port, String tinydb, String login, String password)
1080
XmlRpcClient xmlrpcLogin = new XmlRpcClient();
1082
XmlRpcClientConfigImpl xmlrpcConfigLogin = new XmlRpcClientConfigImpl();
1083
xmlrpcConfigLogin.setEnabledForExtensions(true);
1084
xmlrpcConfigLogin.setServerURL(new URL("http",host,port,"/xmlrpc/common"));
1086
xmlrpcLogin.setConfig(xmlrpcConfigLogin);
1090
params = new Object[] {tinydb,login,password};
1091
Object id = xmlrpcLogin.execute("login", params);
1092
if (id instanceof Integer)
1096
catch (XmlRpcException e) {
1097
logger.warn("XmlException Error while logging to OpenERP: ",e);
1102
logger.warn("Error while logging to OpenERP: ",e);
1107
.. i18n: * **Search**
1112
.. i18n: * **Create**
1117
.. i18n: * **Write**
1138
.. i18n: Python Example
1139
.. i18n: --------------
1145
.. i18n: Example of creation of a partner and their address.
1148
Example of creation of a partner and their address.
1150
.. i18n: .. code-block:: python
1152
.. i18n: import xmlrpclib
1154
.. i18n: sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
1156
.. i18n: pwd = 'demo'
1158
.. i18n: partner = {
1159
.. i18n: 'title': 'Monsieur',
1160
.. i18n: 'name': 'Fabien Pinckaers',
1161
.. i18n: 'lang': 'fr',
1162
.. i18n: 'active': True,
1165
.. i18n: partner_id = sock.execute(dbname, uid, pwd, 'res.partner', 'create', partner)
1167
.. i18n: address = {
1168
.. i18n: 'partner_id': partner_id,
1169
.. i18n: 'type': 'default',
1170
.. i18n: 'street': 'Rue du vieux chateau, 21',
1171
.. i18n: 'zip': '1457',
1172
.. i18n: 'city': 'Walhain',
1173
.. i18n: 'phone': '(+32)10.68.94.39',
1174
.. i18n: 'fax': '(+32)10.68.94.39',
1177
.. i18n: sock.execute(dbname, uid, pwd, 'res.partner.address', 'create', address)
1180
.. code-block:: python
1184
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
1189
'title': 'Monsieur',
1190
'name': 'Fabien Pinckaers',
1195
partner_id = sock.execute(dbname, uid, pwd, 'res.partner', 'create', partner)
1198
'partner_id': partner_id,
1200
'street': 'Rue du vieux chateau, 21',
1203
'phone': '(+32)10.68.94.39',
1204
'fax': '(+32)10.68.94.39',
1207
sock.execute(dbname, uid, pwd, 'res.partner.address', 'create', address)
1209
.. i18n: To get the UID of a user, you can use the following script:
1212
To get the UID of a user, you can use the following script:
1214
.. i18n: .. code-block:: python
1216
.. i18n: sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/common')
1217
.. i18n: UID = sock.login('terp3', 'admin', 'admin')
1220
.. code-block:: python
1222
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/common')
1223
UID = sock.login('terp3', 'admin', 'admin')
1225
.. i18n: CRUD example:
1230
.. i18n: .. code-block:: python
1233
.. i18n: :The login function is under
1234
.. i18n: :: http://localhost:8069/xmlrpc/common
1235
.. i18n: :For object retrieval use:
1236
.. i18n: :: http://localhost:8069/xmlrpc/object
1238
.. i18n: import xmlrpclib
1240
.. i18n: user = 'admin'
1241
.. i18n: pwd = 'admin'
1242
.. i18n: dbname = 'terp3'
1243
.. i18n: model = 'res.partner'
1245
.. i18n: sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/common')
1246
.. i18n: uid = sock.login(dbname ,user ,pwd)
1248
.. i18n: sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
1250
.. i18n: # CREATE A PARTNER
1251
.. i18n: partner_data = {'name'.. code-block:: php:'Tiny', 'active':True, 'vat':'ZZZZZ'}
1252
.. i18n: partner_id = sock.execute(dbname, uid, pwd, model, 'create', partner_data)
1254
.. i18n: # The relation between res.partner and res.partner.category is of type many2many
1255
.. i18n: # To add categories to a partner use the following format:
1256
.. i18n: partner_data = {'name':'Provider2', 'category_id': [(6,0,[3, 2, 1])]}
1257
.. i18n: # Where [3, 2, 1] are id fields of lines in res.partner.category
1259
.. i18n: # SEARCH PARTNERS
1260
.. i18n: args = [('vat', '=', 'ZZZZZ'),]
1261
.. i18n: ids = sock.execute(dbname, uid, pwd, model, 'search', args)
1263
.. i18n: # READ PARTNER DATA
1264
.. i18n: fields = ['name', 'active', 'vat', 'ref']
1265
.. i18n: results = sock.execute(dbname, uid, pwd, model, 'read', ids, fields)
1266
.. i18n: print results
1268
.. i18n: # EDIT PARTNER DATA
1269
.. i18n: values = {'vat':'ZZ1ZZ'}
1270
.. i18n: results = sock.execute(dbname, uid, pwd, model, 'write', ids, values)
1272
.. i18n: # DELETE PARTNER DATA
1273
.. i18n: results = sock.execute(dbname, uid, pwd, model, 'unlink', ids)
1276
.. code-block:: python
1279
:The login function is under
1280
:: http://localhost:8069/xmlrpc/common
1281
:For object retrieval use:
1282
:: http://localhost:8069/xmlrpc/object
1289
model = 'res.partner'
1291
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/common')
1292
uid = sock.login(dbname ,user ,pwd)
1294
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
1297
partner_data = {'name'.. code-block:: php:'Tiny', 'active':True, 'vat':'ZZZZZ'}
1298
partner_id = sock.execute(dbname, uid, pwd, model, 'create', partner_data)
1300
# The relation between res.partner and res.partner.category is of type many2many
1301
# To add categories to a partner use the following format:
1302
partner_data = {'name':'Provider2', 'category_id': [(6,0,[3, 2, 1])]}
1303
# Where [3, 2, 1] are id fields of lines in res.partner.category
1306
args = [('vat', '=', 'ZZZZZ'),]
1307
ids = sock.execute(dbname, uid, pwd, model, 'search', args)
1310
fields = ['name', 'active', 'vat', 'ref']
1311
results = sock.execute(dbname, uid, pwd, model, 'read', ids, fields)
1315
values = {'vat':'ZZ1ZZ'}
1316
results = sock.execute(dbname, uid, pwd, model, 'write', ids, values)
1318
# DELETE PARTNER DATA
1319
results = sock.execute(dbname, uid, pwd, model, 'unlink', ids)
1321
.. i18n: PRINT example:
1326
.. i18n: 1. PRINT INVOICE
1327
.. i18n: 2. IDS is the invoice ID, as returned by:
1328
.. i18n: 3. ids = sock.execute(dbname, uid, pwd, 'account.invoice', 'search', [('number', 'ilike', invoicenumber), ('type', '=', 'out_invoice')])
1332
2. IDS is the invoice ID, as returned by:
1333
3. ids = sock.execute(dbname, uid, pwd, 'account.invoice', 'search', [('number', 'ilike', invoicenumber), ('type', '=', 'out_invoice')])
1335
.. i18n: .. code-block:: python
1337
.. i18n: import time
1338
.. i18n: import base64
1339
.. i18n: printsock = xmlrpclib.ServerProxy('http://server:8069/xmlrpc/report')
1340
.. i18n: model = 'account.invoice'
1341
.. i18n: id_report = printsock.report(dbname, uid, pwd, model, ids, {'model': model, 'id': ids[0], 'report_type':'pdf'})
1342
.. i18n: time.sleep(5)
1343
.. i18n: state = False
1344
.. i18n: attempt = 0
1345
.. i18n: while not state:
1346
.. i18n: report = printsock.report_get(dbname, uid, pwd, id_report)
1347
.. i18n: state = report['state']
1348
.. i18n: if not state:
1349
.. i18n: time.sleep(1)
1350
.. i18n: attempt += 1
1351
.. i18n: if attempt>200:
1352
.. i18n: print 'Printing aborted, too long delay !'
1354
.. i18n: string_pdf = base64.decodestring(report['result'])
1355
.. i18n: file_pdf = open('/tmp/file.pdf','w')
1356
.. i18n: file_pdf.write(string_pdf)
1357
.. i18n: file_pdf.close()
1360
.. code-block:: python
1364
printsock = xmlrpclib.ServerProxy('http://server:8069/xmlrpc/report')
1365
model = 'account.invoice'
1366
id_report = printsock.report(dbname, uid, pwd, model, ids, {'model': model, 'id': ids[0], 'report_type':'pdf'})
1371
report = printsock.report_get(dbname, uid, pwd, id_report)
1372
state = report['state']
1377
print 'Printing aborted, too long delay !'
1379
string_pdf = base64.decodestring(report['result'])
1380
file_pdf = open('/tmp/file.pdf','w')
1381
file_pdf.write(string_pdf)
1384
.. i18n: PHP Example
1385
.. i18n: -----------
1391
.. i18n: Here is an example on how to insert a new partner using PHP. This example makes use the phpxmlrpc library, available on sourceforge.
1394
Here is an example on how to insert a new partner using PHP. This example makes use the phpxmlrpc library, available on sourceforge.
1396
.. i18n: .. code-block:: php
1400
.. i18n: include('xmlrpc.inc');
1402
.. i18n: $arrayVal = array(
1403
.. i18n: 'name'=>new xmlrpcval('Fabien Pinckaers', "string") ,
1404
.. i18n: 'vat'=>new xmlrpcval('BE477472701' , "string")
1407
.. i18n: $client = new xmlrpc_client("http://localhost:8069/xmlrpc/object");
1409
.. i18n: $msg = new xmlrpcmsg('execute');
1410
.. i18n: $msg->addParam(new xmlrpcval("dbname", "string"));
1411
.. i18n: $msg->addParam(new xmlrpcval("3", "int"));
1412
.. i18n: $msg->addParam(new xmlrpcval("demo", "string"));
1413
.. i18n: $msg->addParam(new xmlrpcval("res.partner", "string"));
1414
.. i18n: $msg->addParam(new xmlrpcval("create", "string"));
1415
.. i18n: $msg->addParam(new xmlrpcval($arrayVal, "struct"));
1417
.. i18n: $resp = $client->send($msg);
1419
.. i18n: if ($resp->faultCode())
1421
.. i18n: echo 'Error: '.$resp->faultString();
1425
.. i18n: echo 'Partner '.$resp->value()->scalarval().' created !';
1434
include('xmlrpc.inc');
1437
'name'=>new xmlrpcval('Fabien Pinckaers', "string") ,
1438
'vat'=>new xmlrpcval('BE477472701' , "string")
1441
$client = new xmlrpc_client("http://localhost:8069/xmlrpc/object");
1443
$msg = new xmlrpcmsg('execute');
1444
$msg->addParam(new xmlrpcval("dbname", "string"));
1445
$msg->addParam(new xmlrpcval("3", "int"));
1446
$msg->addParam(new xmlrpcval("demo", "string"));
1447
$msg->addParam(new xmlrpcval("res.partner", "string"));
1448
$msg->addParam(new xmlrpcval("create", "string"));
1449
$msg->addParam(new xmlrpcval($arrayVal, "struct"));
1451
$resp = $client->send($msg);
1453
if ($resp->faultCode())
1455
echo 'Error: '.$resp->faultString();
1459
echo 'Partner '.$resp->value()->scalarval().' created !';
1463
.. i18n: Perl Example
1464
.. i18n: ------------
1465
.. i18n: Here is an example in Perl for creating, searching and deleting a partner.
1470
Here is an example in Perl for creating, searching and deleting a partner.
1472
.. i18n: .. code-block:: perl
1474
.. i18n: #!c:/perl/bin/perl
1475
.. i18n: # 17-02-2010
1476
.. i18n: # OpenERP XML RPC communication example
1477
.. i18n: # Todor Todorov <todorov@hp.com> <tttodorov@yahoo.com>
1479
.. i18n: use strict;
1480
.. i18n: use Frontier::Client;
1481
.. i18n: use Data::Dumper;
1483
.. i18n: my($user) = 'admin';
1484
.. i18n: my($pw) = 'admin';
1485
.. i18n: my($db) = 'put_your_dbname_here';
1486
.. i18n: my($model) = 'res.partner';
1489
.. i18n: my $server_url = 'http://localhost:8069/xmlrpc/common';
1490
.. i18n: my $server = Frontier::Client->new('url' => $server_url);
1491
.. i18n: my $uid = $server->call('login',$db,$user,$pw);
1493
.. i18n: print Dumper($uid);
1495
.. i18n: my $server_url = 'http://localhost:8069/xmlrpc/object';
1496
.. i18n: my $server = Frontier::Client->new('url' => $server_url);
1498
.. i18n: print Dumper($server);
1501
.. i18n: # CREATE A PARTNER
1503
.. i18n: my $partner_data = {'name'=>'MyNewPartnerName',
1504
.. i18n: 'active'=> 'True',
1505
.. i18n: 'vat'=>'ZZZZZ'};
1506
.. i18n: my $partner_id = $server->call('execute',$db, $uid, $pw, $model, 'create', $partner_data);
1508
.. i18n: print Dumper($partner_id);
1511
.. i18n: # SEARCH PARTNERS
1513
.. i18n: my $query = [['vat', '=', 'ZZZZZ']];
1515
.. i18n: print Dumper($query);
1517
.. i18n: my $ids = $server->call('execute',$db, $uid, $pw, $model, 'search', $query);
1519
.. i18n: print Dumper($ids);
1521
.. i18n: #Here waiting for user input
1522
.. i18n: #OpenERP interface my be checked if partner is shown there
1524
.. i18n: print $/."Check OpenERP if partner is inserted. Press ENTER".$/;
1528
.. i18n: # DELETE PARTNER DATA
1530
.. i18n: my $results = $server->call('execute',$db, $uid, $pw, $model, 'unlink', $ids);
1532
.. i18n: print Dumper($results);
1535
.. code-block:: perl
1539
# OpenERP XML RPC communication example
1540
# Todor Todorov <todorov@hp.com> <tttodorov@yahoo.com>
1543
use Frontier::Client;
1546
my($user) = 'admin';
1548
my($db) = 'put_your_dbname_here';
1549
my($model) = 'res.partner';
1552
my $server_url = 'http://localhost:8069/xmlrpc/common';
1553
my $server = Frontier::Client->new('url' => $server_url);
1554
my $uid = $server->call('login',$db,$user,$pw);
1558
my $server_url = 'http://localhost:8069/xmlrpc/object';
1559
my $server = Frontier::Client->new('url' => $server_url);
1561
print Dumper($server);
1566
my $partner_data = {'name'=>'MyNewPartnerName',
1569
my $partner_id = $server->call('execute',$db, $uid, $pw, $model, 'create', $partner_data);
1571
print Dumper($partner_id);
1576
my $query = [['vat', '=', 'ZZZZZ']];
1578
print Dumper($query);
1580
my $ids = $server->call('execute',$db, $uid, $pw, $model, 'search', $query);
1584
#Here waiting for user input
1585
#OpenERP interface my be checked if partner is shown there
1587
print $/."Check OpenERP if partner is inserted. Press ENTER".$/;
1591
# DELETE PARTNER DATA
1593
my $results = $server->call('execute',$db, $uid, $pw, $model, 'unlink', $ids);
1595
print Dumper($results);
1597
.. i18n: Everything done in the GTK or web client in OpenERP is through XML/RPC webservices. Start openERP GTK client
1598
.. i18n: using ./openerp-client.py -l debug_rpc (or debug_rpc_answer) then do what you want in the GTK client and watch
1599
.. i18n: your client logs, you will find out the webservice signatures. By creating indents in the logs will help you to
1600
.. i18n: spot which webservice you want.
1603
Everything done in the GTK or web client in OpenERP is through XML/RPC webservices. Start openERP GTK client
1604
using ./openerp-client.py -l debug_rpc (or debug_rpc_answer) then do what you want in the GTK client and watch
1605
your client logs, you will find out the webservice signatures. By creating indents in the logs will help you to
1606
spot which webservice you want.