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
<recordid="..."model="account.chart.template">
<!-- [Required] Specify the name to display for this CoA. -->
<fieldname="name">...</field>
<!-- [Required] Specify the currency. E.g. "base.USD". -->
<fieldname="currency_id"ref="..."/>
<!-- [Required] Specify a prefix of the bank accounts. -->
<fieldname="bank_account_code_prefix">...</field>
<!-- [Required] Specify a prefix of the cash accounts. -->
<fieldname="cash_account_code_prefix">...</field>
<!-- [Optional] Define a parent chart of accounts that will be installed just before this one. -->
<fieldname="parent_id"ref="..."/>
<!-- [Optional] Define the number of digits of account codes. By default, the value is 6. -->
<fieldname="code_digits">...</field>
<!-- [Optional] Boolean to show or not this CoA on the list. By default, the CoA is visible.
This field is mostly used when this CoA has some children (see parent_id field). -->
<fieldname="visible"eval="..."/>
<!-- [Optional] Boolean to enable the Anglo-Saxon accounting. By default, this field is False. -->
<fieldname="use_anglo_saxon"eval="..."/>
<!-- [Optional] Boolean to enable the complete set of taxes. By default, this field is True.
This boolean helps you to choose if you want to propose to the user to encode the sale and purchase rates or choose from list of taxes.
This last choice assumes that the set of tax defined on this template is complete. -->
<fieldname="complete_tax_set"eval="..."/>
<!-- [Optional] Specify the spoken languages.
/!\ This option is only available if your module depends of l10n_multilang.
You must provide the language codes separated by ';', e.g. eval="'en_US;ar_EG;ar_SY'". -->
<fieldname="spoken_languages"eval="..."/>
</record>
For example, let's take a look to the Belgium chart of accounts.
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/14.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
<recordid="..."model="account.account.tag">
<!-- [Required] Specify the name to display for this tag. -->
<fieldname="name">...</field>
<!-- [Optional] Define a scope for this applicability.
The available keys are 'accounts' and 'taxes' but 'accounts' is the default value. -->
<fieldname="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. -->
<fieldname="name">...</field>
<!-- [Required] Set the CoA owning this fiscal position. -->
<fieldname="chart_template_id"ref="..."/>
<!-- [Optional] Add some additional notes. -->
<fieldname="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. -->
<fieldname="sequence"eval="..."/>
<!-- [Optional] Define an account. -->
<fieldname="account_id"ref="..."/>
<!-- [Optional] Define a label to be added to the journal item. -->
<fieldname="label">...</field>
<!-- [Optional] Define the type of amount_type, either 'fixed' or 'percentage'.
The last one is the default value. -->
<fieldname="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. -->
<fieldname="amount">...</field>
<!-- [Optional] Define eventually a tax. -->
<fieldname="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. -->
<fieldname="has_second_line"eval="..."/>
<fieldname="second_account_id"ref="..."/>
<fieldname="second_label">...</field>
<fieldname="second_amount_type">...</field>
<fieldname="second_amount">...</field>
<fieldname="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>`_.