[REF] i18n/localization.rst: rework the entire localization tutorial

Co-authored-by: William Andre <wan@odoo.com>
Co-authored-by: Ivan Yelizariev <iel@odoo.com>
This commit is contained in:
wan 2021-11-30 16:24:42 +00:00 committed by Antoine Vandevenne (anv)
parent cf1c6cf1a1
commit 3dcb08755a
22 changed files with 688 additions and 441 deletions

View File

@ -114,6 +114,7 @@ else:
# data. This is used to point users to available xml_ids when giving values for
# a field with the autodoc_field extension.
model_references = {
'account.account.type': 'addons/account/data/data_account_type.xml',
'res.country': 'odoo/addons/base/data/res_country_data.xml',
'res.currency': 'odoo/addons/base/data/res_currency_data.xml',
}

View File

@ -13,3 +13,5 @@ Tutorials
howtos/backend
howtos/profilecode
howtos/company
howtos/accounting_localization
howtos/translations

View File

@ -0,0 +1,386 @@
=======================
Accounting localization
=======================
.. warning::
This tutorial requires knowledge about how to build a module in Odoo (see
:doc:`/developer/howtos/backend`).
Installation procedure
======================
On installing the `account <{GITHUB_PATH}/addons/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 <{GITHUB_PATH}/addons/l10n_generic_coa>`_ (US) localization module is installed by default.
Check `post init hook <{GITHUB_PATH}/addons/account/__init__.py>`_ for details.
For example, `l10n_ch <{GITHUB_PATH}/addons/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 :file:`__manifest__.py` file:
.. code-block:: py
{
"name": "COUNTRY - Accounting",
"version": "1.0.0",
"category": "Accounting/Localizations/Account Charts",
"license": "LGPL-3",
"depends": [
"account",
# "l10n_multilang",
],
"data": [
# Chart of Accounts
"data/account_chart_template_data.xml",
"data/account_account_tag_data.xml",
"data/account.account.template.csv",
"data/account.group.template.csv",
# Taxes
"data/account_tax_group_data.xml",
"data/account_tax_report_data.xml",
"data/account_tax_template_data.xml",
"data/account_fiscal_position_template_data.xml",
"data/account_account_template_post_data.xml",
"data/account_chart_post_data.xml",
"data/account_chart_template_try_loading.xml",
# Views and others
"views/xxxmodel_views.xml"
],
"demo": [
"demo/demo_company.xml",
]
}
In the first file :file:`data/account_chart_template_data.xml`, we set the name for the chart of accounts along with some basic fields.
.. seealso::
:ref:`Chart Template References <reference/account_chart_template>`
.. example::
`addons/l10n_ch/data/l10n_ch_chart_data.xml <{GITHUB_PATH}/addons/l10n_ch/data/l10n_ch_chart_data.xml>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_ch/data/l10n_ch_chart_data.xml
:condition: odoo_dir_in_path
:language: xml
:start-at: l10nch_chart_template
:end-at: </record>
.. note::
Recommended **xmlid** for the record is `chart_template`.
If you need many chart of accounts, you can add some suffixes, i.e. `chart_template_XXX`.
Chart of Accounts
=================
Account tags
------------
.. seealso::
:ref:`Account Tag References <reference/account_account_tag>`
Tags are a way to sort accounts.
For example, imagine you want to create a financial report having multiple lines but you have no way to find a rule to dispatch the accounts according to their ``code``.
The solution is the usage of tags, one for each report line, to filter accounts like you want.
Put the tags in the :file:`data/account_account_tag_data.xml` file.
.. example::
`addons/l10n_lt/data/account.account.template.csv <{GITHUB_PATH}/addons/l10n_lt/data/account.account.template.csv>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_lt/data/account.account.template.csv
:condition: odoo_dir_in_path
:language: csv
:end-at: account_account_template_1201
.. example::
`addons/l10n_at/data/account_account_template.xml <{GITHUB_PATH}/addons/l10n_at/data/account_account_template.xml>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_at/data/account_account_template.xml
:condition: odoo_dir_in_path
:language: xml
:start-at: chart_at_template_0010
:end-at: </record>
.. _howtos/account_localization/accounts:
Accounts
--------
.. seealso::
- :ref:`Account References <reference/account_account>`
- :doc:`/applications/finance/accounting/getting_started/initial_configuration/chart_of_accounts`
Obviously, :guilabel:`Chart of Accounts` cannot exist without :guilabel:`Accounts`. You need to specify them in :file:`data/account.account.template.csv`.
.. example::
`addons/l10n_ch/data/account.account.template.csv <{GITHUB_PATH}/addons/l10n_ch/data/account.account.template.csv>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_ch/data/account.account.template.csv
:condition: odoo_dir_in_path
:language: csv
:end-at: ch_coa_1171
CSV is prefered but you may use XML format instead.
.. example::
`addons/l10n_at/data/account_account_template.xml <{GITHUB_PATH}/addons/l10n_at/data/account_account_template.xml>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_at/data/account_account_template.xml
:condition: odoo_dir_in_path
:language: xml
:start-at: chart_at_template_0010
:end-at: </record>
.. 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``.
- Only one account of type payable/receivable is enough for the generic case. We need to define a PoS receivable account as well however. (linked in the CoA)
- Don't create too many accounts: 200-300 is enough. But mostly, we try to find a good balance where the CoA needs minimal adapting for most companies afterwards.
Next settings for the chart of accounts are set in a separate file, because we need to provide a :ref:`list of accounts <howtos/account_localization/accounts>` first. In :file:`data/account_chart_post_data.xml`, we set some default accounts:
.. todo add reference to account_id in CoA
.. example::
`addons/l10n_ch/data/l10n_ch_chart_post_data.xml <{GITHUB_PATH}/addons/l10n_ch/data/l10n_ch_chart_post_data.xml>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_ch/data/l10n_ch_chart_post_data.xml
:condition: odoo_dir_in_path
:language: xml
:start-at: l10nch_chart_template
:end-at: </record>
Account groups
--------------
.. seealso::
:ref:`Account Group References <reference/account_group>`
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.
.. example::
`addons/l10n_il/data/account.group.template.csv <{GITHUB_PATH}/addons/l10n_il/data/account.group.template.csv>`_
.. csv-table::
:condition: odoo_dir_in_path
:file: {ODOO_ABSPATH}/addons/l10n_il/data/account.group.template.csv
:widths: 20,20,20,20,20
:header-rows: 1
Taxes
-----
.. seealso::
- :ref:`Tax References <reference/account_tax>`
- :doc:`/applications/finance/accounting/taxation/taxes/taxes`
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 :file:`data/account_tax_group_data.xml` and list the groups:
.. code-block:: xml
<odoo>
<data noupdate="1">
<record id="tax_group_tva_0" model="account.tax.group">
<field name="name">TVA 0%</field>
<field name="country_id" ref="base.ch"/>
</record>
...
</data>
</odoo>
.. example::
`addons/l10n_ch/data/account_tax_group_data.xml <{GITHUB_PATH}/addons/l10n_ch/data/account_tax_group_data.xml>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_ch/data/account_tax_group_data.xml
:condition: odoo_dir_in_path
:language: xml
:start-after: <data
:end-before: </data>
.. example::
`addons/l10n_uk/data/account.tax.group.csv <{GITHUB_PATH}/addons/l10n_uk/data/account.tax.group.csv>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_uk/data/account.tax.group.csv
:condition: odoo_dir_in_path
:language: csv
Now you can add the taxes via :file:`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.
.. example::
`addons/l10n_ae/data/account_tax_template_data.xml <{GITHUB_PATH}/addons/l10n_ae/data/account_tax_template_data.xml>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_ae/data/account_tax_template_data.xml
:condition: odoo_dir_in_path
:language: xml
:start-at: uae_sale_tax_5_dubai
:end-at: </record>
If some accounts should use default taxes, you can set them up in :file:`data/account_account_template_post_data.xml`
Tax Report
----------
.. raw:: html
<div><span class="badge" style="background-color:#AD5E99">Enterprise feature</span><div>
The tax report is declared in the :guilabel:`Invoicing` (`account`) app, but the report is only accessible when :guilabel:`Accounting` (`account_accountant`) is installed.
.. seealso::
- :ref:`Tax Report Line References <reference/account_tax_report_line>`
- :doc:`/applications/finance/accounting/reporting/declarations/tax_returns`
In the previous section, you noticed the fields `invoice_repartition_line_ids` or `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:
.. graphviz:: accounting_localization/tax_report.dot
:class: overflow-auto
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 :ref:`Tax References <reference/account_tax>`, :ref:`Tax Repartition References <reference/account_tax_repartition>`).
And fortunately we have a presentation explaining the tax reports (as in version 13.0) in details:
.. youtube:: PuXE_NyFRTM
:align: right
:width: 700
:height: 394
So, once you have properly configured taxes, you just need to add the :file:`data/account_tax_report_data.xml` file with a record for your `account.tax.report` at the beginning:
.. code-block:: xml
<odoo>
<record id="tax_report" model="account.tax.report">
<field name="name">Tax Report</field>
<field name="country_id" ref="base.XX"/>
</record>
...
</odoo>
... followed by the declaration of its lines, as `account.tax.report.line` records.
.. example::
`addons/l10n_au/data/account_tax_report_data.xml <{GITHUB_PATH}/addons/l10n_au/data/account_tax_report_data.xml>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_au/data/account_tax_report_data.xml
:condition: odoo_dir_in_path
:language: xml
:start-at: tax_report
:end-before: account_tax_report_gstrpt_g3
Fiscal positions
----------------
.. seealso::
- :ref:`Fiscal Position References <reference/account_fiscal_position>`
- :doc:`/applications/finance/accounting/taxation/taxes/fiscal_positions`
Specify fiscal positions in the :file:`data/account_fiscal_position_template_data.xml` file.
.. example::
`addons/l10n_es/data/account_fiscal_position_template_data.xml <{GITHUB_PATH}/addons/l10n_es/data/account_fiscal_position_template_data.xml>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_es/data/account_fiscal_position_template_data.xml
:condition: odoo_dir_in_path
:language: xml
:start-at: fp_nacional
:end-before: fp_intra
Final steps
===========
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 :file:`data/account_chart_template_try_loading.xml` is responsible for that.
.. example::
`addons/l10n_ch/data/account_chart_template_data.xml <{GITHUB_PATH}/addons/l10n_ch/data/account_chart_template_data.xml>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_ch/data/account_chart_template_data.xml
:condition: odoo_dir_in_path
:language: xml
:start-at: <function
:end-at: </function>
Finally, you may add a demo company, so the localization can easily be tested in demo mode.
.. example::
`addons/l10n_ch/demo/demo_company.xml <{GITHUB_PATH}/addons/l10n_ch/demo/demo_company.xml>`_
.. literalinclude:: {ODOO_RELPATH}/addons/l10n_ch/demo/demo_company.xml
:condition: odoo_dir_in_path
:language: xml
:start-after: <odoo>
:end-before: </odoo>
Accounting reports
==================
.. raw:: html
<div><span class="badge" style="background-color:#AD5E99">Enterprise feature</span><div>
.. seealso::
:doc:`/applications/finance/accounting/reporting/overview`
Accounting reports should be added via a separate module `l10n_XX_reports` that should go to the `enterprise repository <{GITHUB_ENT_PATH}>`_.
Basic :file:`__manifest__.py` file for such a module looks as following:
.. code-block:: py
{
"name": "COUNTRY - Accounting Reports",
"category": "Accounting/Localizations/Reporting",
"version": "1.0.0",
"license": "OEEL-1",
"depends": [
"l10n_XX", "account_reports"
],
"data": [
"data/account_financial_html_report_data.xml",
],
"auto_install": True,
}
Functional overview of financial reports is here: :doc:`/applications/finance/accounting/reporting/overview/main_reports`.
Some good examples:
* `l10n_ch_reports/data/account_financial_html_report_data.xml <{GITHUB_ENT_PATH}/l10n_ch_reports/data/account_financial_html_report_data.xml>`_
* `l10n_be_reports/data/account_financial_html_report_data.xml <{GITHUB_ENT_PATH}/l10n_be_reports/data/account_financial_html_report_data.xml>`_
For the fields' meaning, dive directly to the source:
* `account.financial.html.report (v15) <https://github.com/odoo/enterprise/blob/d4eff9d39469cf3fe18589a1547cb0cdb93f4ae9/account_reports/models/account_financial_report.py#L59-L75>`_
* `account.financial.html.report.line (v15) <https://github.com/odoo/enterprise/blob/d4eff9d39469cf3fe18589a1547cb0cdb93f4ae9/account_reports/models/account_financial_report.py#L931-L964>`_
The menu for the new report is created automatically. By default, it is located under :menuselection:`Accounting -> Reporting`.
To create a dedicated section in the :guilabel:`Reporting` menu, you need to create a new `ir.ui.menu` record (usually in the main `l10n_XX` module) and set it as `parent_id` field in the `account.financial.html.report` model. Example for the Belgian localization:
* `ir.ui.menu record in l10n_be <{GITHUB_PATH}/addons/l10n_be/data/menuitem_data.xml>`_
* `parent_id field in l10n_be_reports (v15) <https://github.com/odoo/enterprise/blob/d4eff9d39469cf3fe18589a1547cb0cdb93f4ae9/l10n_be_reports/data/account_financial_html_report_data.xml#L11>`_

View File

@ -0,0 +1,73 @@
digraph foo {
graph [
newrank=true,
overlap=false,
];
node [
fontname="Ubuntu"
fontsize=10,
style="filled,setlinewidth(6)",
shape=box,
height=0.1,
width=0.1,
];
edge [
fontsize=8,
];
res_country[label="res.country", fillcolor=white, penwidth=1];
subgraph cluster_invoice {
style = filled;
label = "Invoices";
color = lightyellow;
node [style=filled, color=white];
account_move_line[label="account.move.line"]
account_tax[label="account.tax"]
account_tax_repartition_line[label="account.tax.repartition.line"];
account_account_tag[label="account.account.tag"];
account_move_line -> account_tax [label="tax_ids | tax_line_ids"];
account_move_line -> account_tax_repartition_line [label="tax_repartition_line_id"];
account_move_line -> account_account_tag [label="tag_ids"];
account_tax_repartition_line -> account_account_tag [label="tag_ids"];
account_tax -> account_tax_repartition_line [label="1 for base, 1..* for tax amount"];
}
subgraph cluster_reporting {
style = filled;
label = "Reporting";
color = mistyrose;
node [style=filled, color=white];
account_tax_report_line[label="account.tax.report.line"];
account_generic_tax_report[label="account.generic.tax.report"];
account_tax_report[label="account.tax.report"];
account_tax_report -> account_generic_tax_report [label="Calls and displays", dir=back];
account_tax_report -> account_tax_report_line [label="0..*"]
}
subgraph cluster_templates {
style = filled;
label = "Templates";
color = lightblue;
node [style=filled, color=white];
account_tax_template[label="account.tax.template"];
account_tax_repartition_line_template[label="account.tax.repartition.line.template"];
account_tax_template -> account_tax_repartition_line_template [label="1 for base, 1..* for tax amount"];
}
{
rank=same;
account_tax;
account_tax_repartition_line;
account_account_tag;
res_country;
}
{
rank=same;
account_tax_report;
account_tax_report_line;
account_tax_template;
account_tax_repartition_line_template;
}
account_tax -> account_tax_template [label="Creates when installing CoA", dir=back];
account_tax_repartition_line -> account_tax_repartition_line_template [label="Creates when installing CoA", dir=back];
account_tax_repartition_line_template -> account_account_tag [label="tag_ids"];
account_tax_report_line -> account_account_tag [label="Creates (+ and -)"];
account_tax_report -> res_country [label="0..1"];
account_account_tag -> res_country [label="0..1"];
}

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -8,5 +8,4 @@ Misc
:titlesonly:
misc/api
misc/i18n
misc/other

View File

@ -1,11 +0,0 @@
:nosearch:
====================
Internationalization
====================
.. toctree::
:titlesonly:
i18n/localization
i18n/translations

View File

@ -1,425 +0,0 @@
=======================
Accounting Localization
=======================
.. warning::
This tutorial requires knowledges about how to build a module in Odoo (see
:doc:`/developer/howtos/backend`).
Building a localization module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When installing the ``accounting`` 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.
For example, ``l10n_be`` will be installed if the company has ``Belgium`` as country.
This behavior is allowed by the presence of a *.xml* file containing the following code:
.. code-block:: xml
<function model="account.chart.template" name="try_loading_for_current_company">
<value eval="[ref(module.template_xmlid)]"/>
</function>
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. -->
<field name="bank_account_code_prefix">...</field>
<!-- [Required] Specify a prefix of the cash accounts. -->
<field name="cash_account_code_prefix">...</field>
<!-- [Optional] Define a parent chart of accounts that will be installed just before this one. -->
<field name="parent_id" ref="..."/>
<!-- [Optional] Define the number of digits of account codes. By default, the value is 6. -->
<field name="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). -->
<field name="visible" eval="..."/>
<!-- [Optional] Boolean to enable the Anglo-Saxon accounting. By default, this field is False. -->
<field name="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. -->
<field name="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'". -->
<field name="spoken_languages" eval="..."/>
</record>
For example, let's take a look to the Belgium chart of accounts.
.. code-block:: xml
<record id="l10nbe_chart_template" model="account.chart.template">
<field name="name">Belgian PCMN</field>
<field name="currency_id" ref="base.EUR"/>
<field name="bank_account_code_prefix">550</field>
<field name="cash_account_code_prefix">570</field>
<field name="spoken_languages" eval="'nl_BE'"/>
</record>
Now that the chart of accounts is created, we can focus on the creation of the templates.
As said previously, each record must reference this record through the ``chart_template_id`` field.
If not, the template will be ignored. The following sections show in details how to create these templates.
Adding a new account to my Chart of Accounts
############################################
It's time to create our accounts. It consists to creating records of ``account.account.template`` type.
Each ``account.account.template`` is able to create an ``account.account`` for each company.
.. code-block:: xml
<record id="..." model="account.account.template">
<!-- [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/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
<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.
An examples coming from the ``l10n_be`` module:
.. code-block:: xml
<record id="a4000" model="account.account.template">
<field name="name">Clients</field>
<field name="code">4000</field>
<field name="user_type_id" ref="account.data_account_type_receivable"/>
<field name="chart_template_id" ref="l10nbe_chart_template"/>
</record>
.. warning::
Don't create too much accounts: 200-300 is enough.
Adding a new tax to my Chart of Accounts
########################################
To create a new tax record, you just need to follow the same process as the creation of accounts.
The only difference being that you must use the ``account.tax.template`` model.
.. code-block:: xml
<record id="..." model="account.tax.template">
<!-- [Required] Specify the name to display for this tax. -->
<field name="name">...</field>
<!-- [Required] Specify the amount.
E.g. 7 with fixed amount_type means v + 7 if v is the amount on which the tax is applied.
If amount_type is 'percent', the tax amount is v * 0.07. -->
<field name="amount" eval="..."/>
<!-- [Required] Set the CoA owning this tax. -->
<field name="chart_template_id" ref="..."/>
<!-- [Required/Optional] Define an account if the tax is not a group of taxes. -->
<field name="account_id" ref="..."/>
<!-- [Required/Optional] Define an refund account if the tax is not a group of taxes. -->
<field name="refund_account_id" ref="..."/>
<!-- [Optional] Define the tax's type.
'sale', 'purchase' or 'none' are the allowed values. 'sale' is the default value.
Note: 'none' means a tax can't be used by itself, however it can still be used in a group. -->
<field name="type_tax_use">...</field>
<!-- [Optional] Define the type of amount:
'group' for a group of taxes, 'fixed' for a tax with a fixed amount or 'percent' for a classic percentage of price.
By default, the type of amount is percentage. -->
<field name="amount_type" eval="..."/>
<!-- [Optional] Define some children taxes.
/!\ Should be used only with an amount_type with 'group' set. -->
<field name="children_tax_ids" eval="..."/>
<!-- [Optional] The sequence field is used to define order in which the tax lines are applied.
By default, sequence = 1. -->
<field name="sequence" eval="..."/>
<!-- [Optional] Specify a short text to be displayed on invoices.
For example, a tax named "15% on Services" can have the following label on invoice "15%". -->
<field name="description">...</field>
<!-- [Optional] Boolean that indicates if the amount should be considered as included in price. False by default.
E.g. Suppose v = 132 and a tax amount of 20.
If price_include = False, the computed amount will be 132 * 0.2 = 26.4.
If price_include = True, the computed amount will be 132 - (132 / 1.2) = 132 - 110 = 22. -->
<field name="price_include" eval="..."/>
<!-- [Optional] Boolean to set to include the amount to the base. False by default.
If True, the subsequent taxes will be computed based on the base tax amount plus the amount of this tax.
E.g. suppose v = 100, t1, a tax of 10% and another tax t2 with 20%.
If t1 doesn't affects the base,
t1 amount = 100 * 0.1 = 10 and t2 amount = 100 * 0.2 = 20.
If t1 affects the base,
t1 amount = 100 * 0.1 = 10 and t2 amount = 110 * 0.2 = 22. -->
<field name="include_base_amount" eval="..."/>
<!-- [Optional] Boolean false by default.
If set, the amount computed by this tax will be assigned to the same analytic account as the invoice line (if any). -->
<field name="analytic" eval="..."/>
<!-- [Optional] Specify some tags.
These tags must have 'taxes' as applicability.
See the previous section for more details. -->
<field name="tag_ids" eval="...">
<!-- [Optional] Define a tax group used to display the sums of taxes in the invoices. -->
<field name="tax_group_id" ref="..."/>
<!-- [Optional] Define the tax exigibility either based on invoice ('on_invoice' value) or
either based on payment using the 'on_payment' key.
The default value is 'on_invoice'. -->
<field name="tax_exigibility">...</field>
<!-- [Optional] Define a cash basis account in case of tax exigibility 'on_payment'. -->
<field name="cash_basis_account" red="..."/>
</record>
An example found in the ``l10n_pl`` module:
.. code-block:: xml
<record id="vp_leas_sale" model="account.tax.template">
<field name="chart_template_id" ref="pl_chart_template"/>
<field name="name">VAT - leasing pojazdu(sale)</field>
<field name="description">VLP</field>
<field name="amount">1.00</field>
<field name="sequence" eval="1"/>
<field name="amount_type">group</field>
<field name="type_tax_use">sale</field>
<field name="children_tax_ids" eval="[(6, 0, [ref('vp_leas_sale_1'), ref('vp_leas_sale_2')])]"/>
<field name="tag_ids" eval="[(6,0,[ref('l10n_pl.tag_pl_21')])]"/>
<field name="tax_group_id" ref="tax_group_vat_23"/>
</record>
Adding a new fiscal position to my Chart of Accounts
####################################################
.. note::
If you need more information about what is a fiscal position and how it works in Odoo,
please refer to :doc:`/applications/finance/accounting/taxation/taxes/fiscal_positions`.
To create a new fiscal position, simply use the ``account.fiscal.position.template`` model:
.. code-block:: xml
<record id="..." model="account.fiscal.position.template">
<!-- [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.
.. code-block:: xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="l10n_xx_chart_template" model="account.chart.template">
<!-- Define receivable/payable accounts. -->
<field name="property_account_receivable_id" ref="..."/>
<field name="property_account_payable_id" ref="..."/>
<!-- Define categories of expense/income account. -->
<field name="property_account_expense_categ_id" ref="..."/>
<field name="property_account_income_categ_id" ref="..."/>
<!-- Define input/output accounts for stock valuation. -->
<field name="property_stock_account_input_categ_id" ref="..."/>
<field name="property_stock_account_output_categ_id" ref="..."/>
<!-- Define an account template for stock valuation. -->
<field name="property_stock_valuation_account_id" ref="..."/>
<!-- Define loss/gain exchange rate accounts. -->
<field name="expense_currency_exchange_account_id" ref="..."/>
<field name="income_currency_exchange_account_id" ref="..."/>
<!-- Define a transfer account. -->
<field name="transfer_account_id" ref="..."/>
</record>
</odoo>
For example, let's come back to the Belgium PCMN. This chart of accounts is override in this way to add some properties.
.. code-block:: xml
<record id="l10nbe_chart_template" model="account.chart.template">
<field name="property_account_receivable_id" ref="a4000"/>
<field name="property_account_payable_id" ref="a440"/>
<field name="property_account_expense_categ_id" ref="a600"/>
<field name="property_account_income_categ_id" ref="a7010"/>
<field name="expense_currency_exchange_account_id" ref="a654"/>
<field name="income_currency_exchange_account_id" ref="a754"/>
<field name="transfer_account_id" ref="trans"/>
</record>
How to create a new bank operation model?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. note::
How a bank operation model works exactly in Odoo? See :doc:`/applications/finance/accounting/bank/reconciliation/reconciliation_models`.
Since ``V10``, a new feature is available in the bank statement reconciliation widget: the bank operation model.
This allows the user to pre-fill some accounting entries with a single click.
The creation of an ``account.reconcile.model.template`` record is quite easy:
.. code-block:: xml
<record id="..." model="account.reconcile.model.template">
<!-- [Required] Specify the name to display. -->
<field name="name">...</field>
<!-- [Required] Set the CoA owning this. -->
<field name="chart_template_id" ref="..."/>
<!-- [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>`_.

View File

@ -17,3 +17,4 @@ Backend
backend/testing
backend/http
backend/mixins
backend/standard_modules

View File

@ -0,0 +1,10 @@
:nosearch:
================
Standard modules
================
.. toctree::
:titlesonly:
standard_modules/account

View File

@ -0,0 +1,17 @@
:nosearch:
==========
Accounting
==========
.. toctree::
:titlesonly:
account/account_account_tag
account/account_account
account/account_chart_template
account/account_fiscal_position
account/account_group
account/account_tax_report_line
account/account_tax
account/account_tax_repartition

View File

@ -0,0 +1,19 @@
.. _reference/account_account:
=======
Account
=======
.. automodel:: odoo.addons.account.models.chart_template.AccountAccountTemplate
:main:
.. autofield:: name
.. autofield:: currency_id
.. autofield:: code
.. autofield:: user_type_id
.. autofield:: reconcile
.. autofield:: note
.. autofield:: tax_ids
.. autofield:: nocreate
.. autofield:: chart_template_id
.. autofield:: tag_ids

View File

@ -0,0 +1,16 @@
.. _reference/account_account_tag:
===========
Account Tag
===========
.. automodel:: odoo.addons.account.models.account_account_tag.AccountAccountTag
:main:
.. autofield:: name
.. autofield:: applicability
.. autofield:: color
.. autofield:: active
.. autofield:: tax_report_line_ids
.. autofield:: tax_negate
.. autofield:: country_id

View File

@ -0,0 +1,50 @@
.. _reference/account_chart_template:
==============
Chart Template
==============
.. automodel:: odoo.addons.account.models.chart_template.AccountChartTemplate
:main:
.. autofield:: name
.. autofield:: parent_id
.. autofield:: code_digits
.. autofield:: visible
.. autofield:: currency_id
.. autofield:: country_id
.. autofield:: use_anglo_saxon
.. autofield:: bank_account_code_prefix
.. autofield:: cash_account_code_prefix
.. autofield:: transfer_account_code_prefix
.. autofield:: account_ids
.. autofield:: income_currency_exchange_account_id
.. autofield:: expense_currency_exchange_account_id
.. autofield:: account_journal_suspense_account_id
.. autofield:: account_journal_payment_debit_account_id
.. autofield:: account_journal_payment_credit_account_id
.. autofield:: default_cash_difference_income_account_id
.. autofield:: default_cash_difference_expense_account_id
.. autofield:: default_pos_receivable_account_id
.. autofield:: property_account_receivable_id
.. autofield:: property_account_payable_id
.. autofield:: property_account_expense_categ_id
.. autofield:: property_account_income_categ_id
.. autofield:: property_account_expense_id
.. autofield:: property_account_income_id
.. autofield:: property_stock_account_input_categ_id
.. autofield:: property_stock_account_output_categ_id
.. autofield:: property_stock_valuation_account_id
.. autofield:: property_tax_payable_account_id
.. autofield:: property_tax_receivable_account_id
.. autofield:: property_advance_tax_payment_account_id
.. autofield:: property_cash_basis_base_account_id
.. automodel:: odoo.addons.l10n_multilang.models.account.AccountChartTemplate
Multi language support for Chart of Accounts, Taxes, Tax Codes, Journals,
Accounting Templates, Analytic Chart of Accounts and Analytic Journals.
.. autofield:: spoken_languages

View File

@ -0,0 +1,22 @@
.. _reference/account_fiscal_position:
===============
Fiscal Position
===============
.. automodel:: odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate
:main:
.. autofield:: sequence
.. autofield:: name
.. autofield:: chart_template_id
.. autofield:: account_ids
.. autofield:: tax_ids
.. autofield:: note
.. autofield:: auto_apply
.. autofield:: vat_required
.. autofield:: country_id
.. autofield:: country_group_id
.. autofield:: state_ids
.. autofield:: zip_from
.. autofield:: zip_to

View File

@ -0,0 +1,14 @@
.. _reference/account_group:
=============
Account Group
=============
.. automodel:: odoo.addons.account.models.chart_template.AccountGroupTemplate
:main:
.. autofield:: parent_id
.. autofield:: name
.. autofield:: code_prefix_start
.. autofield:: code_prefix_end
.. autofield:: chart_template_id

View File

@ -0,0 +1,28 @@
.. _reference/account_tax:
=====
Taxes
=====
.. automodel:: odoo.addons.account.models.chart_template.AccountTaxTemplate
:main:
.. autofield:: chart_template_id
.. autofield:: name
.. autofield:: type_tax_use
.. autofield:: tax_scope
.. autofield:: amount_type
.. autofield:: active
.. autofield:: children_tax_ids
.. autofield:: sequence
.. autofield:: amount
.. autofield:: description
.. autofield:: price_include
.. autofield:: include_base_amount
.. autofield:: is_base_affected
.. autofield:: analytic
.. autofield:: invoice_repartition_line_ids
.. autofield:: refund_repartition_line_ids
.. autofield:: tax_group_id
.. autofield:: tax_exigibility
.. autofield:: cash_basis_transition_account_id

View File

@ -0,0 +1,16 @@
.. _reference/account_tax_repartition:
================
Tax Repartitions
================
.. automodel:: odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate
:main:
.. autofield:: factor_percent
.. autofield:: repartition_type
.. autofield:: account_id
.. autofield:: invoice_tax_id
.. autofield:: refund_tax_id
.. autofield:: tag_ids
.. autofield:: use_in_tax_closing

View File

@ -0,0 +1,24 @@
.. _reference/account_tax_report_line:
===============
Tax Report Line
===============
.. automodel:: odoo.addons.account.models.account_tax_report.AccountTaxReportLine
:main:
.. autofield:: name
.. autofield:: tag_ids
.. autofield:: report_action_id
.. autofield:: children_line_ids
.. autofield:: parent_id
.. autofield:: sequence
.. autofield:: report_id
.. autofield:: tag_name
.. autofield:: code
.. autofield:: formula
.. autofield:: carry_over_condition_method
.. autofield:: carry_over_destination_line_id
.. autofield:: carryover_line_ids
.. autofield:: is_carryover_persistent
.. autofield:: is_carryover_used_in_balance

View File

@ -1134,7 +1134,7 @@ to be translated. The way it currently works is the following:
is found.
Note that translations are explained in more details, from the server point of
view, in the document :doc:`/developer/misc/i18n/translations`.
view, in the document :doc:`/developer/howtos/translations`.
There are two important functions for the translations in javascript: *_t* and
*_lt*. The difference is that *_lt* is lazily evaluated.
@ -2245,5 +2245,3 @@ For more information, look into the `control_panel_renderer.js <https://github.c
https://api.jquery.com/delegate/
.. _datepicker: https://github.com/Eonasdan/bootstrap-datetimepicker

View File

@ -336,4 +336,11 @@ developer/reference/javascript/qweb.rst developer/refer
developer/reference/backend/assets.rst developer/reference/frontend/assets.rst
developer/reference/frontend/owl_component_system.rst developer/reference/frontend/owl_components.rst
developer/reference/frontend/generic_components.rst developer/reference/frontend/owl_components.rst
developer/reference/frontend/generic_components.rst developer/reference/frontend/owl_components.rst
developer/misc/i18n/localization.rst developer/howtos/accounting_localization.rst
developer/misc/i18n/translations.rst developer/howtos/translations.rst
# Redirections introduced in saas-15.1 :
# Redirections introduced in saas-15.2 :