Skip to content
Snippets Groups Projects
Commit 9c11356ed99b authored by Brendan Masson's avatar Brendan Masson
Browse files

Update README

parent c1f6a8e754c9
No related branches found
No related tags found
No related merge requests found
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
--------------------------- ---------------------------
You cannot delete analytic codes that are referenced by objects. You cannot delete analytic codes that are referenced by objects.
Moreover, you cannot delete objects that reference analytic codes that are referenced elsewhere. The goal of this constraint is to ensure the integrity of your analyses.
.. _ConfigureAnalyticFields: .. _ConfigureAnalyticFields:
...@@ -81,8 +81,6 @@ ...@@ -81,8 +81,6 @@
translate (False): enable or disable the translation of field values on translate (False): enable or disable the translation of field values on
analytic dimensions (name) and codes (name and description). analytic dimensions (name) and codes (name and description).
.. _MetaAnalytic: .. _MetaAnalytic:
Add the MetaAnalytic metaclass to a model Add the MetaAnalytic metaclass to a model
...@@ -167,6 +165,46 @@ ...@@ -167,6 +165,46 @@
}"/> }"/>
Advanced: Para-analytic fields
------------------------------
Para-analytic fields are a more advanced feature of analytic_structure.
They differ from ordinary analytics fields in two ways:
- They are entirely configurable, meaning that you decide their type and parameters
- They don't have predefined behaviors
Para-analytic fields are defined in with the ``_para_analytic`` attribute.
For each entry in ``_para_analytic`` the ``MetaAnalytic`` metaclass will create a number fields.
The number of fields depend on ``analytic_size`` in the configuration file (see ConfigureAnalyticFields_).
Each entry is key-value pair of a dict where the key is a (prefix, suffix) tuple and the value a dict containing the following:
``model`` the name of the referenced dimension model (doesn't do anything special)
``type`` a field class, the field type to use
``default`` default value for the fields
``args`` list of arguments to inject in ``type`` constructor
``kwargs`` dict of keyword arguments to inject in ``type`` constructor.
Here is declaration that will create fields with the names ``a1_b``, ``a2_b``, ``a3_b``, ...
.. code:: python
from openerp import fields
# ...
# Inside a class
_para_analytic = {
('a', 'b'): {
'model': 'account_move_line',
'type': fields.Boolean,
'default': True,
'args': ("field is optional"),
'kwargs': dict(required=True),
a,}
}
Validation hook for analytic fields Validation hook for analytic fields
----------------------------------- -----------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment