Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions content/developer/howtos/accounting_localization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ Tax Report
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:`/developer/reference/standard_modules/account/account_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:
Expand All @@ -258,27 +258,22 @@ In the previous section, you noticed the fields `invoice_repartition_line_ids` o

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:
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.report`. For it to be considered as a tax report, you need to provide it with the right `root_report_id`.

.. code-block:: xml

<odoo>
<record id="tax_report" model="account.tax.report">
<record id="tax_report" model="account.report">
<field name="name">Tax Report</field>
<field name="root_report_id" ref="account.generic_tax_report"/>
<field name="country_id" ref="base.XX"/>
</record>

...
</odoo>

... followed by the declaration of its lines, as `account.tax.report.line` records.
... followed by the declaration of its lines, as `account.report.line` records.

.. example::
`addons/l10n_au/data/account_tax_report_data.xml <{GITHUB_PATH}/addons/l10n_au/data/account_tax_report_data.xml>`_
Expand Down Expand Up @@ -361,7 +356,8 @@ Basic :file:`__manifest__.py` file for such a module looks as following:
"l10n_XX", "account_reports"
],
"data": [
"data/account_financial_html_report_data.xml",
"data/balance_sheet.xml",
"data/profit_and_loss.xml",
],
"auto_install": True,
}
Expand All @@ -374,13 +370,12 @@ 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:
You can check the meaning of the fields here:

* `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>`_
* :doc:`/developer/reference/standard_modules/account/account_report`
* :doc:`/developer/reference/standard_modules/account/account_report_line`

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:
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 :guilabel:`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:

* `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>`_
* `parent_id field in l10n_be_reports (v16) <https://github.com/odoo/enterprise/blob/a1614d0b1460dc453cbe395efba41573d29e7b7e/l10n_be_reports/data/partner_vat_listing.xml#L55-L65>`_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this commit really exists on the repo, and that it will get garbage collected at some point

28 changes: 18 additions & 10 deletions content/developer/howtos/accounting_localization/tax_report.dot
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ digraph foo {
label = "Invoices";
color = lightyellow;
node [style=filled, color=white];
edge [fontsize=8,];
account_move_line[label="account.move.line"]
account_tax[label="account.tax"]
account_tax_repartition_line[label="account.tax.repartition.line"];
Expand All @@ -35,21 +36,27 @@ digraph foo {
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];
edge [fontsize=8,];
account_tax_report [label="account.report"];
account_tax_report_line [label="account.report.line"];
account_report_expression [label="account.report.expression"];
account_tax_report -> account_tax_report_line [label="0..*"]
}
subgraph cluster_templates {
style = filled;
label = "Templates";
color = lightblue;
node [style=filled, color=white];
edge [fontsize=8,];
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_move_line;
account_tax_report;
}
{
rank=same;
account_tax;
Expand All @@ -59,15 +66,16 @@ digraph foo {
}
{
rank=same;
account_tax_report;
account_tax_report_line;
account_report_expression;
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 -> account_tax_template [label=" Creates when\n installing CoA", dir=back];
account_tax_repartition_line -> account_tax_repartition_line_template[label=" Creates when\n 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_line -> account_report_expression [label="0..*"];
account_tax_report_line -> account_tax_report_line [label="children_ids"];
account_report_expression -> account_account_tag [label="Engine tax_tags 1..*"];
account_tax_report -> res_country [label="0..1"];
account_account_tag -> res_country [label="0..1"];
}
}
3 changes: 2 additions & 1 deletion content/developer/reference/standard_modules/account.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Accounting
account/account_chart_template
account/account_fiscal_position
account/account_group
account/account_tax_report_line
account/account_report
account/account_report_line
account/account_tax
account/account_tax_repartition
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ Account Tag
.. autofield:: applicability
.. autofield:: color
.. autofield:: active
.. autofield:: tax_report_line_ids
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have all the models that lead from the reports to the tags

.. autofield:: tax_negate
.. autofield:: country_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

===============
Report
===============

.. automodel:: odoo.addons.account.models.account_report.AccountReport
:main:

.. autofield:: name
.. autofield:: line_ids
.. autofield:: column_ids
.. autofield:: root_report_id
.. autofield:: chart_template_id
.. autofield:: country_id
.. autofield:: only_tax_exigible
.. autofield:: caret_options_initializer
.. autofield:: availability_condition
.. autofield:: load_more_limit
.. autofield:: search_bar
.. autofield:: default_opening_date_filter
.. autofield:: filter_multi_company
.. autofield:: filter_date_range
.. autofield:: filter_show_draft
.. autofield:: filter_unreconciled
.. autofield:: filter_unfold_all
.. autofield:: filter_period_comparison
.. autofield:: filter_growth_comparison
.. autofield:: filter_journals
.. autofield:: filter_analytic
.. autofield:: filter_hierarchy
.. autofield:: filter_account_type
.. autofield:: filter_partner
.. autofield:: filter_fiscal_position
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

===============
Report Line
===============

.. automodel:: odoo.addons.account.models.account_report.AccountReportLine
:main:

.. autofield:: name
.. autofield:: expression_ids
.. autofield:: report_id
.. autofield:: hierarchy_level
.. autofield:: parent_id
.. autofield:: children_ids
.. autofield:: foldable
.. autofield:: print_on_new_page
.. autofield:: action_id
.. autofield:: hide_if_zero

This file was deleted.