Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Analytic Structure
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo modules
Analytic Structure
Commits
490c4a52
Commit
490c4a52
authored
9 years ago
by
Brendan Masson
Browse files
Options
Downloads
Patches
Plain Diff
Format README in ReStructured Text
parent
028a0512
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.rst
+78
-56
78 additions, 56 deletions
README.rst
with
78 additions
and
56 deletions
README
→
README
.rst
+
78
−
56
View file @
490c4a52
== Configure your OpenERP server for analytic fields ==
Analytic Structure
==================
...
@@ -2,3 +3,5 @@
...
@@ -2,3 +3,5 @@
Configure your OpenERP server for analytic fields
-------------------------------------------------
In your OpenERP server's configuration file, you can set several optional
In your OpenERP server's configuration file, you can set several optional
...
@@ -3,4 +6,4 @@
...
@@ -3,4 +6,4 @@
In your OpenERP server's configuration file, you can set several optional
In your OpenERP server's configuration file, you can set several optional
parameters related to the analytic module.
parameters related to the analytic module.
::
...
@@ -6,6 +9,6 @@
...
@@ -6,6 +9,6 @@
[analytic]
[analytic]
key = value ...
key = value ...
Those options must be grouped under the [analytic] category. If the category
Those options must be grouped under the [analytic] category. If the category
...
@@ -21,8 +24,8 @@
...
@@ -21,8 +24,8 @@
==
Add the MetaAnalytic metaclass to a model
==
Add the MetaAnalytic metaclass to a model
-----------------------------------------
At the beginning of the source file, import the MetaAnalytic metaclass:
At the beginning of the source file, import the MetaAnalytic metaclass:
...
@@ -31,7 +34,9 @@
...
@@ -31,7 +34,9 @@
Inside your Model class, define MetaAnalytic to be used as metaclass:
Inside your Model class, define MetaAnalytic to be used as metaclass:
__metaclass__ = MetaAnalytic
.. code:: python
__metaclass__ = MetaAnalytic
...
@@ -35,7 +40,8 @@
...
@@ -35,7 +40,8 @@
== Add analytic fields to a model ==
Add analytic fields to a model
------------------------------
First of all, make sure you are using the MetaAnalytic metaclass.
First of all, make sure you are using the MetaAnalytic metaclass.
...
@@ -44,8 +50,10 @@
...
@@ -44,8 +50,10 @@
Use the analytic fields associated with the model:
Use the analytic fields associated with the model:
_analytic = True
.. code:: python
_analytic = True
Use analytic fields associated with another model:
Use analytic fields associated with another model:
...
@@ -48,9 +56,11 @@
...
@@ -48,9 +56,11 @@
Use analytic fields associated with another model:
Use analytic fields associated with another model:
_analytic = 'account_move_line'
.. code:: python
_analytic = 'account_move_line'
Use several analytic field structures, associated with different prefixes:
Use several analytic field structures, associated with different prefixes:
...
@@ -53,10 +63,12 @@
...
@@ -53,10 +63,12 @@
Use several analytic field structures, associated with different prefixes:
Use several analytic field structures, associated with different prefixes:
_analytic = {
.. code:: python
'a': 'account_asset_asset',
't': 'account_move_line',
_analytic = {
}
'a': 'account_asset_asset',
't': 'account_move_line',
}
...
@@ -61,8 +73,7 @@
...
@@ -61,8 +73,7 @@
Add analytic fields to a view
== Add analytic fields to a view ==
-----------------------------
Analytic fields can be added to the view individually, like any other field:
Analytic fields can be added to the view individually, like any other field:
...
@@ -66,7 +77,9 @@
...
@@ -66,7 +77,9 @@
Analytic fields can be added to the view individually, like any other field:
Analytic fields can be added to the view individually, like any other field:
<field name="a1_id" />
.. code:: xml
<field name="a1_id" />
'a' is the prefix associated with the structure. By default, it is 'a'.
'a' is the prefix associated with the structure. By default, it is 'a'.
'1' is the dimension's ordering as defined by the analytic structure.
'1' is the dimension's ordering as defined by the analytic structure.
...
@@ -76,7 +89,9 @@
...
@@ -76,7 +89,9 @@
(defined by its prefix) that wasn't explicitly placed in the view. This field is automatically generated when
(defined by its prefix) that wasn't explicitly placed in the view. This field is automatically generated when
you call the Metaclass
you call the Metaclass
<field name="analytic_dimensions" required="1" prefix="t" />
.. code:: xml
<field name="analytic_dimensions" required="1" prefix="t" />
The prefix can be omitted for a structure that uses the default prefix 'a'.
The prefix can be omitted for a structure that uses the default prefix 'a'.
Any other attribute will be propagated to the analytic fields.
Any other attribute will be propagated to the analytic fields.
...
@@ -85,10 +100,12 @@
...
@@ -85,10 +100,12 @@
Warning: analytic fields should generally not be used inside nested sub-views.
Warning: analytic fields should generally not be used inside nested sub-views.
If possible, create a separate record and use the context to specify the view:
If possible, create a separate record and use the context to specify the view:
<field name="order_line" colspan="4" nolabel="1" context="{
.. code:: xml
'form_view_ref' : 'module.view_id',
'tree_view_ref' : 'module.view_id'
<field name="order_line" colspan="4" nolabel="1" context="{
}"/>
'form_view_ref' : 'module.view_id',
'tree_view_ref' : 'module.view_id'
}"/>
...
@@ -92,8 +109,8 @@
...
@@ -92,8 +109,8 @@
==
Bind an analytic dimension to a model
==
Bind an analytic dimension to a model
-------------------------------------
First of all, make sure you are using the MetaAnalytic metaclass.
First of all, make sure you are using the MetaAnalytic metaclass.
Then, add the _dimension attribute to your class, using the following syntax.
Then, add the _dimension attribute to your class, using the following syntax.
...
@@ -101,8 +118,10 @@
...
@@ -101,8 +118,10 @@
Bind the model to an analytic dimension named after the model, using default values:
Bind the model to an analytic dimension named after the model, using default values:
_dimension = True
.. code:: python
_dimension = True
Bind the model to an analytic dimension with a specified name, using default values:
Bind the model to an analytic dimension with a specified name, using default values:
...
@@ -105,9 +124,11 @@
...
@@ -105,9 +124,11 @@
Bind the model to an analytic dimension with a specified name, using default values:
Bind the model to an analytic dimension with a specified name, using default values:
_dimension = 'Funding Source'
.. code:: python
_dimension = 'Funding Source'
Bind the model to an analytic dimension, using either custom or default values:
Bind the model to an analytic dimension, using either custom or default values:
...
@@ -110,19 +131,21 @@
...
@@ -110,19 +131,21 @@
Bind the model to an analytic dimension, using either custom or default values:
Bind the model to an analytic dimension, using either custom or default values:
_dimension = {
.. code:: python
'name': 'School',
'column': 'analytic_code_id',
_dimension = {
'ref_id': 'school_analytic_dimension',
'name': 'School',
'ref_module': 'my_module',
'column': 'analytic_code_id',
'sync_parent': False,
'ref_id': 'school_analytic_dimension',
'rel_description': True,
'ref_module': 'my_module',
'rel_active': (u"Active", 'active_code'),
'sync_parent': False,
'use_inherits': False,
'rel_description': True,
'use_code_name_methods': False,
'rel_active': (u"Active", 'active_code'),
}
'use_inherits': False,
'use_code_name_methods': False,
}
key (default value): description
key (default value): description
...
@@ -125,9 +148,9 @@
...
@@ -125,9 +148,9 @@
key (default value): description
key (default value): description
name (= _description or _name): The name of the analytic dimension.
`
name
`
(=
`
_description
`
or
`
_name
`
): The name of the analytic dimension.
This name is only used when creating the dimension in the database.
This name is only used when creating the dimension in the database.
column (analytic_id): The field that links each record to an analytic code.
column (analytic_id): The field that links each record to an analytic code.
...
@@ -130,8 +153,8 @@
...
@@ -130,8 +153,8 @@
This name is only used when creating the dimension in the database.
This name is only used when creating the dimension in the database.
column (analytic_id): The field that links each record to an analytic code.
column (analytic_id): The field that links each record to an analytic code.
ref_id (= _name + analytic_dimension_id): The external ID that will
`
ref_id
`
(=
`
_name
`
+
`
analytic_dimension_id
`
): The external ID that will
be used by the analytic dimension. By setting this value, you can allow two
be used by the analytic dimension. By setting this value, you can allow two
models to use the same dimension, or a model to use an already existing one.
models to use the same dimension, or a model to use an already existing one.
...
@@ -135,6 +158,6 @@
...
@@ -135,6 +158,6 @@
be used by the analytic dimension. By setting this value, you can allow two
be used by the analytic dimension. By setting this value, you can allow two
models to use the same dimension, or a model to use an already existing one.
models to use the same dimension, or a model to use an already existing one.
ref_module (empty string): The name of the module associated with the dimension
`
ref_module
`
(empty string): The name of the module associated with the dimension
record. Change this value in order to use a dimension defined in a data file.
record. Change this value in order to use a dimension defined in a data file.
...
@@ -139,4 +162,4 @@
...
@@ -139,4 +162,4 @@
record. Change this value in order to use a dimension defined in a data file.
record. Change this value in order to use a dimension defined in a data file.
sync_parent (False): Controls the synchronization of the codes' parent-child
`
sync_parent
`
(
`
False
`
): Controls the synchronization of the codes' parent-child
hierarchy with that of the model. When using an inherited, renamed parent field,
hierarchy with that of the model. When using an inherited, renamed parent field,
...
@@ -142,3 +165,3 @@
...
@@ -142,3 +165,3 @@
hierarchy with that of the model. When using an inherited, renamed parent field,
hierarchy with that of the model. When using an inherited, renamed parent field,
you must give the parent field name rather than simply True.
you must give the parent field name rather than simply
`
True
`
.
...
@@ -144,5 +167,5 @@
...
@@ -144,5 +167,5 @@
use_inherits (special): Determines whether the analytic codes should be bound
`
use_inherits
`
(special): Determines whether the analytic codes should be bound
to the records by inheritance, or through a simple many2one field.
to the records by inheritance, or through a simple many2one field.
Inheritance allows for better synchronization, but can only be used if there
Inheritance allows for better synchronization, but can only be used if there
are no duplicate fields between the two objects.
are no duplicate fields between the two objects.
...
@@ -146,7 +169,7 @@
...
@@ -146,7 +169,7 @@
to the records by inheritance, or through a simple many2one field.
to the records by inheritance, or through a simple many2one field.
Inheritance allows for better synchronization, but can only be used if there
Inheritance allows for better synchronization, but can only be used if there
are no duplicate fields between the two objects.
are no duplicate fields between the two objects.
The default value is True if the model has no 'name' and 'code_parent_id' field
The default value is
`
True
`
if the model has no 'name' and 'code_parent_id' field
as well as no inheritance of any kind, and False otherwise. If the object has
as well as no inheritance of any kind, and
`
False
`
otherwise. If the object has
inheritances that do not cause conflicts, you can set it to True.
inheritances that do not cause conflicts, you can set it to
`
True
`
.
...
@@ -152,7 +175,7 @@
...
@@ -152,7 +175,7 @@
rel_active (False): Create a related field in the model, targeting the
`
rel_active
`
(
`
False
`
): Create a related field in the model, targeting the
analytic code field 'active' and with an appropriate store parameter.
analytic code field 'active' and with an appropriate store parameter.
This is useful when the model doesn't inherit analytic_code and/or when it
This is useful when the model doesn't inherit analytic_code and/or when it
already has a field named 'active'.
already has a field named 'active'.
Can take a pair of string values: (field label, field name).
Can take a pair of string values: (field label, field name).
If given a string, the default field name 'active' will be used.
If given a string, the default field name 'active' will be used.
...
@@ -154,7 +177,7 @@
...
@@ -154,7 +177,7 @@
analytic code field 'active' and with an appropriate store parameter.
analytic code field 'active' and with an appropriate store parameter.
This is useful when the model doesn't inherit analytic_code and/or when it
This is useful when the model doesn't inherit analytic_code and/or when it
already has a field named 'active'.
already has a field named 'active'.
Can take a pair of string values: (field label, field name).
Can take a pair of string values: (field label, field name).
If given a string, the default field name 'active' will be used.
If given a string, the default field name 'active' will be used.
If given True, the default field label 'Active' will also be used.
If given
`
True
`
, the default field label 'Active' will also be used.
...
@@ -160,3 +183,3 @@
...
@@ -160,3 +183,3 @@
rel_description (False): Same as rel_active for the code field 'description'.
`
rel_description
`
(
`
False
`
): Same as rel_active for the code field 'description'.
If given a string, the default field name 'description' will be used.
If given a string, the default field name 'description' will be used.
...
@@ -162,3 +185,3 @@
...
@@ -162,3 +185,3 @@
If given a string, the default field name 'description' will be used.
If given a string, the default field name 'description' will be used.
If given True, the default field label 'Description' will also be used.
If given
`
True
`
, the default field label 'Description' will also be used.
...
@@ -164,8 +187,8 @@
...
@@ -164,8 +187,8 @@
use_code_name_methods (False): Set to True in order to override the methods
`
use_code_name_methods
`
(
`
False
`
): Set to
`
True
`
in order to override the methods
name_get and name_search, using those of analytic code.
name_get and name_search, using those of analytic code.
This allows the analytic code's description to be displayed (and searched)
This allows the analytic code's description to be displayed (and searched)
along with the entry's name in many2one fields targeting the model.
along with the entry's name in many2one fields targeting the model.
...
@@ -166,12 +189,12 @@
...
@@ -166,12 +189,12 @@
name_get and name_search, using those of analytic code.
name_get and name_search, using those of analytic code.
This allows the analytic code's description to be displayed (and searched)
This allows the analytic code's description to be displayed (and searched)
along with the entry's name in many2one fields targeting the model.
along with the entry's name in many2one fields targeting the model.
===
Active / View type / Disabled in my company
===
Active / View type / Disabled in my company
-------------------------------------------
Differences between the various "active" fields:
Differences between the various "active" fields:
- Active: Determines whether an analytic code is in the referential.
- Active: Determines whether an analytic code is in the referential.
...
@@ -174,7 +197,6 @@
...
@@ -174,7 +197,6 @@
Differences between the various "active" fields:
Differences between the various "active" fields:
- Active: Determines whether an analytic code is in the referential.
- Active: Determines whether an analytic code is in the referential.
- View type: Determines whether an analytic code is not selectable (but still
- View type: Determines whether an analytic code is not selectable (but still
in the referential).
in the referential).
...
@@ -179,5 +201,4 @@
...
@@ -179,5 +201,4 @@
- View type: Determines whether an analytic code is not selectable (but still
- View type: Determines whether an analytic code is not selectable (but still
in the referential).
in the referential).
- Disabled per company: Determines whether an analytic code is disabled for the
- Disabled per company: Determines whether an analytic code is disabled for the
current company.
current company.
...
@@ -182,2 +203,3 @@
...
@@ -182,2 +203,3 @@
- Disabled per company: Determines whether an analytic code is disabled for the
- Disabled per company: Determines whether an analytic code is disabled for the
current company.
current company.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment