experimental
Package¶
This package store experimental features of openerp-proxy project usualy implemented as extensions or plugins.
Warning
Ususaly code placed here have no tests and might be changed or moved to other packages. Even it may not work!
Use this functionality on your own risk!
experimental.ipy_utils
Module¶
This module contains some IPython integration utils
-
openerp_proxy.experimental.ipy_utils.
in_progress
(seq, msg='Progress: [%(processed)d / %(total)d]', length=None)[source]¶ Iterate over sequence, yielding item with progress widget displayed. This is useful if you need to precess sequence of items with some time consuming operations
Note
This works only in Jupyter Notebook
Note
This function requires ipywidgets package to be installed
Parameters: - seq – sequence to iterate on.
- msg (str) – (optional) message template to display. available to use ‘processed’ and ‘total’ integer vars, where ‘processed’ is number of items processed and ‘total’ is total number of items in seq.
- length (int) – (optional) if seq is generator, or it is not possible to apply ‘len(seq)’ function to ‘seq’, then this argument is required and it’s value will be used as total number of items in seq.
Example example:
import time for i in in_progress(range(10)): time.sleep(1)
experimental.onchange
Module¶
Implement onchange related logic for Odoo 8.0+ onchanges api
-
class
openerp_proxy.experimental.onchange.
ObjectOnchangeUtils
(service, object_name)[source]¶ Bases:
openerp_proxy.experimental.utils.ObjectUtils
-
find_onchanges
(view_info=None)¶ Find onchange spec for specified model and view
Parameters: view_info (dict) – result of model’s fields_view_get
orget_view_info
methodReturns: dict of format {‘field’: bool(have onchange)}
-
parse_model_subfields
(fields)¶ returns tuple: tuple({model: [fields]}, model_fields, related_fields)
-
process_onchanges
(data, fields=None, view_info=None, context=None)¶ Run onchanges
Parameters: - data (dict) – data to be processed by onchanges
- fields (list) – list of changed fields (optional)
- view_info (dict) – result of model’s
fields_view_get
orget_view_info
method (optional) - context (dict) – context to prcess onchanges within (optional)
Returns: result of onchange events
-
process_onchanges_r
(data, fields=None, view_info=None, keep_fields=None, context=None)¶
-
process_onchanges_x
(data, *args, **kwargs)¶ Same as process_onchanges but applies convert_to_write method to its result
-
experimental.relations
Module¶
This module contains functions and classes that could be used to get information abour record relations
-
class
openerp_proxy.experimental.relations.
RecordListRelations
(obj, ids=None, fields=None, cache=None, context=None)[source]¶ Bases:
openerp_proxy.orm.record.RecordList
Find all links to all records from other models
-
class
openerp_proxy.experimental.relations.
RecordRelations
(obj, rid, cache=None, context=None)[source]¶ Bases:
openerp_proxy.orm.record.Record
Find all links to this record
-
get_rel_data_domain
(field)¶
-
class
openerp_proxy.experimental.relations.
RelationsObject
(service, object_name)[source]¶ Bases:
openerp_proxy.orm.object.Object
Get a dictionary {<model>: RecordList(‘ir.model.fields’)} which contains related models, and list of relational fields that points to specified model
Get related models for specified model
return RecordList(‘ir.model’) which contains models related to specified model
experimental.utils
Module¶
-
class
openerp_proxy.experimental.utils.
ObjectUtils
(service, object_name)[source]¶ Bases:
openerp_proxy.orm.object.Object
-
convert_to_write
(data)¶ Simple function that adapts data, to be suitable for odoo write functions.
At this moment used mostly to adapt results of odoo’s
onchange
model method.Parameters: data (dict) – data to be converted Returns: data suitable for Odoo’s create/write methods
-
get_view_info
(view_id=None)¶ Get view_info for specified model (result of
fields_view_get
)if view_id is not passed, default model view is used if view_id is string, than it is assumed that it is xmlid of view
Parameters: - model (str) – string model name (Ex. ‘account.invoice’)
- view_id (int|str) – integer ID or xmlid of view to get info for
Returns: result of model’s
fields_view_get
-