On installing the account module, the localization module corresponding to the country code of the company is installed automatically. In case of no country code set or no localization module found, the l10n_generic_coa (US) localization module is installed by default. Check post init hook for details.
For example, l10n_ch will be installed if the company has
Switzerland as country.
Building a localization module
The structure of a basic
l10n_XX module may be described with the following
In the first file
data/account_chart_template_data.xml, we set the name for the chart of accounts along with some basic fields.
Chart of Accounts
Obviously, Chart of Accounts cannot exist without Accounts. You need to specify them in
CSV is prefered but you may use XML format instead.
Next settings for the chart of accounts are set in a separate file, because we need to provide a list of accounts first. In
data/account_chart_post_data.xml, we set some default accounts:
Account groups allow describing the hierarchical structure of the chart of accounts. The filter needs to be activated in the report and then when you decollapse into journal entries it will show the parents of the account.
It works with the prefix start/end, so every account where the code starts with something between start and end will have this account.group as the parent group. Furthermore, the account groups can have a parent account group as well to form the hierarchy.
To add taxes you first need to specify tax groups. You normally need just one tax group for every tax rate, except for the 0% as you need to often distinguish between exempt, 0%, not subject, … taxes. This model only has two required fields: name and country. Create the file
data/account_tax_group_data.xml and list the groups:
Now you can add the taxes via
data/account_tax_template_data.xml file. The first tax you define that is purchase/sale also becomes the default purchase/sale tax for your products.
If some accounts should use default taxes, you can set them up in
The tax report is declared in the Invoicing (
account) app, but the report is only accessible when Accounting (
account_accountant) is installed.
In the previous section, you noticed the fields
refund_repartition_line_ids and probably understood nothing about them. Good news: you are not alone on this incomprehension. Bad news: you have to figure it out a bit. The topic is complicated. Indeed:
The simple version is that, in the tax template, you indicate in the invoice/refund repartition lines whether the base or a percentage of the tax needs to be reported in which report line (through the minus/plus_report_line_ids fields). It becomes clear also when you check the tax configuration in the Odoo interface (or check the docs Tax References, Tax Repartition References).
So, once you have properly configured taxes, you just need to add the
data/account_tax_report_data.xml file with a record for your
account.report. For it to be considered as a tax report, you need to provide it with the right
… followed by the declaration of its lines, as
Specify fiscal positions in the
The last step when installing a localization module is to try to apply its chart of accounts to the current company (if it does not already have one). The file
data/account_chart_template_try_loading.xml is responsible for that.
Finally, you may add a demo company, so the localization can easily be tested in demo mode.
Accounting reports should be added via a separate module
l10n_XX_reports that should go to the enterprise repository.
__manifest__.py file for such a module looks as following:
Functional overview of financial reports is here: Main reports available.
Some good examples:
You can check the meaning of the fields here:
If you gave a
root_report_id to your report, it is now available in its variant selector. If not, you still need to add a menu item for it. A default menu item can be created from the form view of the report, by clicking on ‘Actions’, then ‘Create Menu Item’. You’ll then need to refresh the page to see it. Alternatively, to create a dedicated section for a totally new report in the Reporting menu, you need to create a new
ir.ui.menu record (usually in the main
l10n_XX module) and a new
ir.actions.client (usually in the new report xml file) that calls the
account.report with the new report id. Then, set the new menu as
parent_id field in the action model. Example for the Belgian localization: