service Package

openerp_proxy.service.get_service_class(name)[source]

Return service class specified by it’s name

class openerp_proxy.service.ServiceBase(service, client, name)[source]

Bases: object

Base class for all Services

Parameters:
  • service – instance of original service class. must support folowing syntax service.service_method(args) to call remote methods
  • client – instance of Client, this service is binded to
clean_cache()[source]

To be implemented by subclasses, if needed

client

Related Client instance

name

Service name

class openerp_proxy.service.ServiceManager(client)[source]

Bases: extend_me.Extensible, odoo_rpc_client.utils.DirMixIn

Class to hold services related to specific client and to automaticaly clean service cached on update of service classes

Usage:

services = ServiceManager(client)
services.service_list          # get list of registered services
services.object                # returns service with name 'object'
services['common']             # returns service with name 'common'
services.get_service('report') # returns service named 'report'
clean_cache()[source]

Cleans manager’s service cache.

classmethod clean_caches()[source]

Cleans saved service instances, so on next access new service instances will be generated. This usualy happens when new service extension enabled (new class inherited from ServiceBase created)

clean_service_caches()[source]

Clean caches of all services handled by this mananger usualy this should be called on module update, when list of available objects or reports changed

client

Client instance this ServiceManager is bounded to

get_service(name)[source]

Returns instance of service with specified name

Parameters:name – name of service
Returns:specified service instance
service_list

Returns list of all registered services

db Module

object Module

report Module

Report printing logic

Best way to generate report is:

data_records = client['res.partner'].search_records([], limit=10)
report = client.services.report['res.partner'].generate(data_records)
report.content

Or if it is desired to save it on disk:

data_records = client['res.partner'].search_records([], limit=10)
report = client.services.report['res.partner'].generate(data_records)
report.save('filename to save report with')

where report is instance of ReportResult and report.content returns already base64 decoded content of report, which could be directly written to file (or just use report.save(path) method)

service Module