Plugins Package

This package contains plugins provided out-of-the-box

module_utils Plugin

class openerp_proxy.plugins.module_utils.ModuleObject(service, object_name)[source]

Bases: openerp_proxy.orm.object.Object

Add shortcut methods to ‘ir.module.module’ object / model to install or upgrade modules

Also this methods will be available for Record instances too

class Meta[source]
name = 'ir.module.module'
ModuleObject.install(ids, context=None)[source]

Immediatly install module

ModuleObject.upgrade(ids, context=None)[source]

Immediatly upgrades module

class openerp_proxy.plugins.module_utils.ModuleUtils(*args, **kwargs)[source]

Bases: openerp_proxy.plugin.Plugin, openerp_proxy.utils.DirMixIn

Utility plugin to simplify module management

Allows to access Odoo module objects as attributes of this plugin:

# this method supports IPython autocomplete
db.plugins.module_utils.m_stock

or dictionary style access to modules:

db.plugins.moduld_utils['stock']

which is equivalent to

db.get_obj('ir.module.module').search_records(
    [('name','=','stock')])[0]

Also autocomplete in IPython supported for this syntax

class Meta[source]
name = 'module_utils'
ModuleUtils.installed_modules

RecordList with list of modules installed in currenct database

Return type:RecordList
ModuleUtils.modules

Returns dictionary of modules registered in system.

Result dict is like: {'module_name': module_inst}

where module_inst is Record instance for this module

ModuleUtils.update_module_list()[source]

Update module list

If there are some modules added to server, update list, to be able to installe them.

external_ids Plugin

class openerp_proxy.plugins.external_ids.ExternalIDS(client)[source]

Bases: openerp_proxy.plugin.Plugin

This plugin adds aditional methods to work with external_ids (xml_id) for Odoo records.

class Meta[source]
name = 'external_ids'
ExternalIDS.get_for(val, module=None)[source]

Return RecordList of ‘ir.model.data’ for val or False

Parameters:
  • val – value to get ‘ir.model.data’ records for
  • module (str) – module name to search ‘ir.model.data’ for
Return type:

RecordList

Returns:

RecordList with ‘ir.model.data’ records found

Raises ValueError:
 

if val argument could not be parsed

val could be one of folowing types:

  • Record instance
  • RecordList instance
  • tuple(model, res_id), for example ('res.partner', 5)
  • str, string in format ‘module.name’.

Note, in case of val is str: if module specified as parameter, then val supposed to be name only. For example, folowing calls are equal:

cl.plugins.external_ids.get_for('base.group_configuration')
cl.plugins.external_ids.get_for('group_configuration',
                                module='base')
ExternalIDS.get_record(xml_id, module=None)[source]

Return Record instance for specified xml_id

Parameters:
  • xml_id (str) – string with xml_id to search record for
  • module (str) – module name to search Record in
Return type:

Record

Returns:

Record for val or False if not found

Raises ValueError:
 

if xml_id argument could not be parsed

ExternalIDS.get_xmlid(val, module=None)[source]

Return xml_id for val. Note, that only first xml_id will be returned!

Parameters:
  • val – look in documentation for get_for method
  • module (str) – module name to search xml_id for
Return type:

str

Returns:

xml_id for val or False if not found

Raises ValueError:
 

if val argument could not be parsed

Note, that if module specified as parametr, then val supposed to be name only

class openerp_proxy.plugins.external_ids.Record__XMLIDS(obj, rid, cache=None, context=None)[source]

Bases: openerp_proxy.orm.record.Record

Simple class to add ability to get xmlid from record itself

as_xmlid(module=None)[source]

Get xmlid for record

Parameters:module (str) – module to search xmlid in
Returns:xmlid for this record or False
Return type:str

diagraming Plugin

Warning!!! This plugin is in experimental stage!!!

diagraming.graph Module

class openerp_proxy.plugins.diagraming.graph.Graph(*args, **kwargs)[source]

Bases: openerp_proxy.plugin.Plugin

Plugin that allow to build graphs.

At this point it is in experimental stage

class Meta
name = 'yed_graph'
Graph.model_graph(models, depth=1)

Build model graph

class openerp_proxy.plugins.diagraming.graph.Model(obj)[source]

Bases: openerp_proxy.plugins.diagraming.graphml_yed.NodeBigEntity

Odoo model abstraction layer

client
fields
name
object
class openerp_proxy.plugins.diagraming.graph.ModelGraph(client, models, depth=1)[source]

Bases: extend_me.Extensible

Contains single model graph

clean()

Clean graph

depth

Graph depth

generate_graph()

Return pydot.Dot instance of graph

graph

Return pydot.Dot instance of graph

class openerp_proxy.plugins.diagraming.graph.ModelM2MRelation(source, target, field_name)[source]

Bases: openerp_proxy.plugins.diagraming.graph.ModelRelation

Many-to-many relation abstraction.

Represents many-to-many relation betwen two models

m2m_columns
m2m_table
to_graphml()
class openerp_proxy.plugins.diagraming.graph.ModelRelation(source, target, field_name)[source]

Bases: object

Model relation abstraction layer. Represents relation betwen models

client
field_info
ir_field
rel_field_info
rel_field_name
rel_type
to_graphml()