# HG changeset patch # User Brendan Masson <brendan.masson@xcg-consulting.fr> # Date 1459519021 -7200 # Fri Apr 01 15:57:01 2016 +0200 # Branch odoo8 # Node ID 9c11356ed99b72eda7d4e1508eee44b71cbe6b2a # Parent c1f6a8e754c9b7c75698ce61cc5b5cca59966866 Update README diff --git a/README.rst b/README.rst --- a/README.rst +++ b/README.rst @@ -56,7 +56,7 @@ --------------------------- 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: @@ -81,8 +81,6 @@ translate (False): enable or disable the translation of field values on analytic dimensions (name) and codes (name and description). - - .. _MetaAnalytic: Add the MetaAnalytic metaclass to a model @@ -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 -----------------------------------