OdooDoc documentation¶
Installation¶
This extension requires the following packages:
- Sphinx >= 1.2
- erppeek
- path.py
Use pip
to install this extension straight from the Python Package Index:
pip install odoodoc
Configuration¶
In order to use odoodoc you should add it to the list of extensions in conf.py:
extensions = ['sphinxcontrib.odoodoc']
Usage¶
OdooDoc adds the following set of directives to be used in the docs:
Field¶
You can refer to any field with the following directive:
.. field:: model/field
which will print the given field name inside an span with the class odoodocfield. You can change this default class with the configuration option odoodoc_fieldclass.
Optionally the :help:
flag can be added. See the following example:
.. field:: res.partner/street
:help:
It will print the help text of field despite of the field name (if the field doesn’t have help text it will print a message advertising it).
It also have the optional option :class: CLASSLIST
.
Inline usage¶
Inline usage is also available either using Sphinx’s replace mechanism. As it uses the directive it has all options and the same behaviour than directives:
This is a reference to field |partner_street|.
.. |partner_street| field:: res.partner/street
or one provided by odoodoc, which is shorter (but it doesn’t put the text inside and span tag and it doesn’t support any option):
This is a reference to a field @field:res.partner/street@.
In this shorter syntax, options are added at the end, separated by colons. For example:
@field:res.partner/street:help@
@menu:account/periodical_processing_journal_entries_validation:nameonly@
Model Fields List¶
This directive takes an Odoo model as argument and generates a Field List for all fields having a Help string defined. In the field list, the columns String and Help are displayed.
The syntax is as follows:
.. fields:: model.name
:fields: field1 field2
:class: class1
If option :fields:
is specified, it should be a list of fields separated by one blank.
If this option is not specified, it will list all fields by default.
You can style the field list table using the optional :class: CLASSLIST
option,
or assigning a CLASSLIST to the variable odoodoc_fieldlistclass
in conf.py
file.
FA Icon¶
You can insert any FontAwesome Icon using the faicon role.
:faicon:`envelope`
This role simply inserts the following HTML (only for html writers)
<i class="fa fa-{}" aria-hidden="true"></i>
where {} is the content of the role.