Where ``module.template_xmlid`` is the **fully-qualified** xmlid of the corresponding template.
Usually located in the ``data`` folder, it must be loaded at the very last in the ``__manifest__.py`` file.
..danger::
If the *.xml* file is missing, the right chart of accounts won't be loaded on time!
Configuring my own Chart of Accounts?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
First of all, before I proceed, we need to talk about the templates. A template is a record that allows replica of itself.
This mechanism is needed when working in multi-companies. For example, the creation of a new account is done using the ``account.account.template`` model.
However, each company using this chart of accounts will be linked to a replica having ``account.account`` as model.
So, the templates are never used directly by the company.
Then, when a chart of accounts needs to be installed, all templates dependent of this one will create a replica and link this newly generated record to the company's user.
It means all such templates must be linked to the chart of accounts in some way. To do so, each one must reference the desired chart of accounts using the ``chart_template_id`` field.
For this reason, we need to define an instance of the ``account.chart.template`` model before creating its templates.
..code-block:: xml
<record id="..." model="account.chart.template">
<!-- [Required] Specify the name to display for this CoA. -->
<field name="name">...</field>
<!-- [Required] Specify the currency. E.g. "base.USD". -->
<field name="currency_id" ref="..."/>
<!-- [Required] Specify a prefix of the bank accounts. -->
<!-- [Required] Specify the name to display for this account. -->
<field name="name">...</field>
<!-- [Required] Specify a code. -->
<field name="code">...</field>
<!-- [Required] Specify a type. -->
<field name="user_type_id">...</field>
<!-- [Required] Set the CoA owning this account. -->
<field name="chart_template_id" ref="..."/>
<!-- [Optional] Specify a secondary currency for each account.move.line linked to this account. -->
<field name="currency_id" ref="..."/>
<!-- [Optional] Boolean to allow the user to reconcile entries in this account. True by default. -->
<field name="reconcile" eval="..."/>
<!-- [Optional] Specify a group for this account. -->
<field name="group_id" ref="...">
<!-- [Optional] Specify some tags. -->
<field name="tag_ids" eval="...">
</record>
Some of the described fields above deserve a bit more explanation.
The ``user_type_id`` field requires a value of type ``account.account.type``.
Although some additional types could be created in a localization module, we encourage the usage of the existing types in the `account/data/data_account_type.xml <https://github.com/odoo/odoo/blob/12.0/addons/account/data/data_account_type.xml>`_ file.
The usage of these generic types ensures the generic reports working correctly in addition to those that you could create in your localization module.
..warning::
Avoid the usage of liquidity ``account.account.type``!
Indeed, the bank & cash accounts are created directly at the installation of the localization module and then, are linked to an ``account.journal``.
..warning::
Only one account of type payable/receivable is enough.
Although the ``tag_ids`` field is optional, this one remains a very powerful feature.
Indeed, this one allows you to define some tags for your accounts to spread them correctly on your reports.
For example, suppose you want to create a financial report having multiple lines but you have no way to find a rule to dispatch the accounts according their ``code`` or ``name``.
The solution is the usage of tags, one for each report line, to spread and aggregate your accounts like you want.
Like any other record, a tag can be created with the following xml structure:
..code-block:: xml
<record id="..." model="account.account.tag">
<!-- [Required] Specify the name to display for this tag. -->
<field name="name">...</field>
<!-- [Optional] Define a scope for this applicability.
The available keys are 'accounts' and 'taxes' but 'accounts' is the default value. -->
<field name="applicability">...</field>
</record>
As you can well imagine with the usage of tags, this feature can also be used with taxes.
<!-- [Required] Specify the name to display for this fiscal position. -->
<field name="name">...</field>
<!-- [Required] Set the CoA owning this fiscal position. -->
<field name="chart_template_id" ref="..."/>
<!-- [Optional] Add some additional notes. -->
<field name="note">...</field>
</record>
Adding the properties to my Chart of Accounts
#############################################
When the whole accounts are generated, you have the possibility to override the newly generated chart of accounts by adding some properties that correspond to default accounts used in certain situations.
This must be done after the creation of accounts before each one must be linked to the chart of accounts.
<!-- [Optional] Set a sequence number defining the order in which it will be displayed.
By default, the sequence is 10. -->
<field name="sequence" eval="..."/>
<!-- [Optional] Define an account. -->
<field name="account_id" ref="..."/>
<!-- [Optional] Define a label to be added to the journal item. -->
<field name="label">...</field>
<!-- [Optional] Define the type of amount_type, either 'fixed' or 'percentage'.
The last one is the default value. -->
<field name="amount_type">...</field>
<!-- [Optional] Define the balance amount on which this model will be applied to (100 by default).
Fixed amount will count as a debit if it is negative, as a credit if it is positive. -->
<field name="amount">...</field>
<!-- [Optional] Define eventually a tax. -->
<field name="tax_id" ref="..."/>
<!-- [Optional] The sames fields are available twice.
To enable a second journal line, you can set this field to true and
fill the fields accordingly. -->
<field name="has_second_line" eval="..."/>
<field name="second_account_id" ref="..."/>
<field name="second_label">...</field>
<field name="second_amount_type">...</field>
<field name="second_amount">...</field>
<field name="second_tax_id" ref="..."/>
</record>
How to create a new dynamic report?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you need to add some reports on your localization, you need to create a new module named **l10n_xx_reports**.
Furthermore, this additional module must be present in the ``enterprise`` repository and must have at least two dependencies,
one to bring all the stuff for your localization module and one more, ``account_reports``, to design dynamic reports.
..code-block:: py
'depends': ['l10n_xx', 'account_reports'],
Once it's done, you can start the creation of your report statements. The documentation is available in the following `slides <https://www.odoo.com/slides/slide/how-to-create-custom-accounting-report-415>`_.