NAME OpenERP::XMLRPC::Simple - Simple interaction with OpenERP XML RPC interface. VERSION version 0.001 SYNOPSIS # CONNECT my $erp = OpenERP::XMLRPC::Simple->new( dbname => 'my_openerp_db', username => 'mylogin', password => 'mypassword', host => '10.0.0.123' ); # READ a res.partner object my $partner = $erp->read( 'res.partner', $id ); print "You Found Partner:" . $partner->{name} . "\n"; DESCRIPTION This module brings together a number of moose roles and the OpenERP::XMLRPC::Client to create a simple and easy to use interface to communicate with OpenERP. NAME OpenERP::XMLRPC::Simple - Simply communicate with your OpenERP database. PARAMETERS username - string - openerp username (default: 'admin') password - string - openerp password (default: 'admin') dbname - string - openerp database name (default: 'terp') host - string - openerp rpc server host (default: '127.0.0.1' ) port - string - openerp rpc server port (default: 8069) proto - string - openerp protocol (default: http) METHODS These methods re-present the OpenERP XML RPC but in a slightly more user friendly way. The methods have been tested using the 'res.partner' object name and the demo database provided when you install OpenERP. read ( OBJECTNAME, [IDS] ) Can pass this a sinlge ID or an ARRAYREF of ID's, it will return an ARRAYREF of OBJECT records (HASHREF's). Example: $partner = $erp->read('res.partner', 1 ); print "This is the returned record name:" . $partner->[0]->{name} . "\n"; $partners = $erp->read('res.partner', [1,2] ); print "This is the returned record 1:" . $partners->[0]->{name} . "\n"; print "This is the returned record 2:" . $partners->[1]->{name} . "\n"; Returns: ArrayRef of HashRef's - All the objects with IDs passed. search ( OBJECTNAME, [ [ COLNAME, COMPARATOR, VALUE ] ] ) Used to search and return IDs of objects matching the searcgh. Returns: ArrayRef of ID's - All the objects ID's matching the search. Example: $results = $erp->search('res.partner', [ [ 'name', 'ilke', 'abc' ] ] ); print "This is the 1st ID found:" . $results->[0] . "\n"; create ( OBJECTNAME, { COLNAME => COLVALUE } ) Returns: ID - the ID of the object created. Example: $new_id = $erp->create('res.partner', { 'name' => 'new company name' } ); update ( OBJECTNAME, ID, { COLNAME => COLVALUE } ) Returns: boolean - updated or not. Example: $success = $erp->update('res.partner', 1, { 'name' => 'changed company name' } ); delete ( OBJECTNAME, ID ) Returns: boolean - deleted or not. Example: $success = $erp->delete('res.partner', 1 ); search_detail ( OBJECTNAME, [ [ COLNAME, COMPARATOR, VALUE ] ] ) Used to search and read details on a perticular OBJECT. This uses 'search' to find IDs, then calls 'read' to get details on each ID returned. Returns: ArrayRef of HashRef's - All the objects found with all their details. Example: $results = $erp->search_detail('res.partner', [ [ 'name', 'ilke', 'abc' ] ] ); print "This is the 1st found record name:" . $results->[0]->{name} . "\n"; read_single ( OBJECTNAME, ID ) Pass this a sinlge ID and get a single OBJECT record (HASHREF). Example: $partner = $erp->read_single('res.partner', 1 ); print "This name of partner with ID 1:" . $partner->{name} . "\n"; Returns: HashRef - The objects data SEE ALSO OpenERP::XMLRPC::Client, RPC::XML::Client, Moose::Role AUTHOR Benjamin Martin COPYRIGHT AND LICENSE Copyright (C) 2010 Opus Vision Limited This software is licensed according to the "IP Assignment Schedule" provided with the development project.