From cd81a97399556ba61d736ccc3ba77138f1420836 Mon Sep 17 00:00:00 2001 From: william-andre Date: Fri, 6 Jan 2023 13:04:09 +0000 Subject: [PATCH] [REF] account: remove chart templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The way of declaring charts of accounts has completely changed. closes odoo/documentation#3336 Related: odoo/enterprise#35836 Related: odoo/odoo#110016 Related: odoo/upgrade#4276 Signed-off-by: William André (wan) --- .../howtos/accounting_localization.rst | 174 +++++------------- .../reference/standard_modules/account.rst | 1 - .../account/account_account.rst | 4 +- .../account/account_chart_template.rst | 50 ----- .../account/account_fiscal_position.rst | 3 +- .../account/account_group.rst | 3 +- .../account/account_report.rst | 1 - .../standard_modules/account/account_tax.rst | 3 +- .../account/account_tax_repartition.rst | 6 +- 9 files changed, 57 insertions(+), 188 deletions(-) delete mode 100644 content/developer/reference/standard_modules/account/account_chart_template.rst diff --git a/content/developer/howtos/accounting_localization.rst b/content/developer/howtos/accounting_localization.rst index 4c3d3eae4..6cf413aac 100644 --- a/content/developer/howtos/accounting_localization.rst +++ b/content/developer/howtos/accounting_localization.rst @@ -32,53 +32,51 @@ The structure of a basic ``l10n_XX`` module may be described with the following "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" + "data/other_data.xml", + "views/xxxmodel_views.xml", ], "demo": [ "demo/demo_company.xml", ] } +Your worktree should look like this -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. +.. code-block:: bash + + l10n_xx + ├── data + │ ├── template + │ │ ├── account.account-xx.csv + │ │ ├── account.group-xx.csv + │ │ └── account.tax.group-xx.csv + │ └── other_data.xml + ├── views + │ └── xxxmodel_views.xml + ├── demo + │ └── demo_company.xml + ├── models + │ ├── template_xx.py + │ └── __init__.py + ├── __init__.py + └── __manifest__.py + + +In the first file :file:`models/template_xx.py`, we set the name for the chart of accounts along with some basic fields. .. seealso:: - :ref:`Chart Template References ` + :doc:`Chart Template References ` .. example:: - `addons/l10n_ch/data/l10n_ch_chart_data.xml <{GITHUB_PATH}/addons/l10n_ch/data/l10n_ch_chart_data.xml>`_ + `addons/l10n_be/models/template_be.py <{GITHUB_PATH}/addons/l10n_be/models/template_be.py>`_ - .. literalinclude:: {ODOO_RELPATH}/addons/l10n_ch/data/l10n_ch_chart_data.xml + .. literalinclude:: {ODOO_RELPATH}/addons/l10n_be/models/template_be.py :condition: odoo_dir_in_path - :language: xml - :start-at: l10nch_chart_template - :end-at: - - -.. 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`. + :language: python + :start-at: _get_be_template_data + :end-before: _get_be_reconcile_model Chart of Accounts @@ -97,24 +95,13 @@ The solution is the usage of tags, one for each report line, to filter accounts 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>`_ + `addons/l10n_lt/data/template/account.account-lt.csv <{GITHUB_PATH}/addons/l10n_lt/data/template/account.account-lt.csv>`_ - .. literalinclude:: {ODOO_RELPATH}/addons/l10n_lt/data/account.account.template.csv + .. literalinclude:: {ODOO_RELPATH}/addons/l10n_lt/data/template/account.account-lt.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: - -.. _howtos/account_localization/accounts: - Accounts -------- @@ -125,44 +112,20 @@ 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>`_ + `addons/l10n_ch/data/template/account.account-ch.csv <{GITHUB_PATH}/addons/l10n_ch/data/template/account.account-ch.csv>`_ - .. literalinclude:: {ODOO_RELPATH}/addons/l10n_ch/data/account.account.template.csv + .. literalinclude:: {ODOO_RELPATH}/addons/l10n_ch/data/template/account.account-ch.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: - .. warning:: - - Avoid the usage of liquidity ``account.account.type``! + - Avoid the usage of `asset_cash` ``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 ` 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: - Account groups -------------- @@ -172,15 +135,15 @@ Account groups 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. +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>`_ + `addons/l10n_il/data/template/account.group-il.csv <{GITHUB_PATH}/addons/l10n_il/data/template/account.group-il.csv>`_ .. csv-table:: :condition: odoo_dir_in_path - :file: {ODOO_RELPATH}/addons/l10n_il/data/account.group.template.csv + :file: {ODOO_RELPATH}/addons/l10n_il/data/template/account.group-il.csv :widths: 20,20,20,20,20 :header-rows: 1 @@ -192,51 +155,27 @@ Taxes - :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 - - - - - TVA 0% - - - - ... - - +This model only has two required fields: `name` and `country`. Create the file :file:`data/template/account.tax.group-xx.csv` and list the groups. .. example:: - `addons/l10n_ch/data/account_tax_group_data.xml <{GITHUB_PATH}/addons/l10n_ch/data/account_tax_group_data.xml>`_ + `addons/l10n_uk/data/template/account.tax.group-uk.csv <{GITHUB_PATH}/addons/l10n_uk/data/template/account.tax.group-uk.csv>`_ - .. literalinclude:: {ODOO_RELPATH}/addons/l10n_ch/data/account_tax_group_data.xml - :condition: odoo_dir_in_path - :language: xml - :start-after: - -.. 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 + .. literalinclude:: {ODOO_RELPATH}/addons/l10n_uk/data/template/account.tax.group-uk.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. +Now you can add the taxes via :file:`data/template/account.tax-xx.csv` 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>`_ + `addons/l10n_ae/data/template/account.tax-ae.csv <{GITHUB_PATH}/addons/l10n_ae/data/template/account.tax-ae.csv>`_ - .. literalinclude:: {ODOO_RELPATH}/addons/l10n_ae/data/account_tax_template_data.xml + .. literalinclude:: {ODOO_RELPATH}/addons/l10n_ae/data/template/account.tax-ae.csv :condition: odoo_dir_in_path :language: xml - :start-at: uae_sale_tax_5_dubai - :end-at: + :end-at: uae_sale_tax_5_ras_al_khaima -If some accounts should use default taxes, you can set them up in :file:`data/account_account_template_post_data.xml` Tax Report ---------- @@ -293,32 +232,19 @@ Fiscal positions - :ref:`Fiscal Position References ` - :doc:`/applications/finance/accounting/taxation/taxes/fiscal_positions` -Specify fiscal positions in the :file:`data/account_fiscal_position_template_data.xml` file. +Specify fiscal positions in the :file:`data/template/account.fiscal.position-xx.csv` file. .. example:: - `addons/l10n_es/data/account_fiscal_position_template_data.xml <{GITHUB_PATH}/addons/l10n_es/data/account_fiscal_position_template_data.xml>`_ + `addons/l10n_es/data/template/account.fiscal.position-es_common.csv <{GITHUB_PATH}/addons/l10n_es/data/template/account.fiscal.position-es_common.csv>`_ - .. literalinclude:: {ODOO_RELPATH}/addons/l10n_es/data/account_fiscal_position_template_data.xml + .. literalinclude:: {ODOO_RELPATH}/addons/l10n_es/data/template/account.fiscal.position-es_common.csv :condition: odoo_dir_in_path - :language: xml - :start-at: fp_nacional - :end-before: fp_intra + :language: csv + :end-at: account_tax_template_p_iva10_sp_ex 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: - Finally, you may add a demo company, so the localization can easily be tested in demo mode. .. example:: diff --git a/content/developer/reference/standard_modules/account.rst b/content/developer/reference/standard_modules/account.rst index 4e0f7d969..0cbd0a9b0 100644 --- a/content/developer/reference/standard_modules/account.rst +++ b/content/developer/reference/standard_modules/account.rst @@ -9,7 +9,6 @@ Accounting account/account_account_tag account/account_account - account/account_chart_template account/account_fiscal_position account/account_group account/account_report diff --git a/content/developer/reference/standard_modules/account/account_account.rst b/content/developer/reference/standard_modules/account/account_account.rst index 312f0482c..e6ebbd1be 100644 --- a/content/developer/reference/standard_modules/account/account_account.rst +++ b/content/developer/reference/standard_modules/account/account_account.rst @@ -4,7 +4,7 @@ Account ======= -.. automodel:: odoo.addons.account.models.chart_template.AccountAccountTemplate +.. automodel:: odoo.addons.account.models.account_account.AccountAccount :main: .. autofield:: name @@ -14,6 +14,4 @@ Account .. autofield:: reconcile .. autofield:: note .. autofield:: tax_ids - .. autofield:: nocreate - .. autofield:: chart_template_id .. autofield:: tag_ids diff --git a/content/developer/reference/standard_modules/account/account_chart_template.rst b/content/developer/reference/standard_modules/account/account_chart_template.rst deleted file mode 100644 index 548fc517a..000000000 --- a/content/developer/reference/standard_modules/account/account_chart_template.rst +++ /dev/null @@ -1,50 +0,0 @@ -.. _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 diff --git a/content/developer/reference/standard_modules/account/account_fiscal_position.rst b/content/developer/reference/standard_modules/account/account_fiscal_position.rst index cd2ffa6bf..becc51720 100644 --- a/content/developer/reference/standard_modules/account/account_fiscal_position.rst +++ b/content/developer/reference/standard_modules/account/account_fiscal_position.rst @@ -4,12 +4,11 @@ Fiscal Position =============== -.. automodel:: odoo.addons.account.models.chart_template.AccountFiscalPositionTemplate +.. automodel:: odoo.addons.account.models.partner.AccountFiscalPosition :main: .. autofield:: sequence .. autofield:: name - .. autofield:: chart_template_id .. autofield:: account_ids .. autofield:: tax_ids .. autofield:: note diff --git a/content/developer/reference/standard_modules/account/account_group.rst b/content/developer/reference/standard_modules/account/account_group.rst index 7d1ba8384..fc796dbb5 100644 --- a/content/developer/reference/standard_modules/account/account_group.rst +++ b/content/developer/reference/standard_modules/account/account_group.rst @@ -4,11 +4,10 @@ Account Group ============= -.. automodel:: odoo.addons.account.models.chart_template.AccountGroupTemplate +.. automodel:: odoo.addons.account.models.account_account.AccountGroup :main: .. autofield:: parent_id .. autofield:: name .. autofield:: code_prefix_start .. autofield:: code_prefix_end - .. autofield:: chart_template_id diff --git a/content/developer/reference/standard_modules/account/account_report.rst b/content/developer/reference/standard_modules/account/account_report.rst index 0136d427f..dcdb13913 100644 --- a/content/developer/reference/standard_modules/account/account_report.rst +++ b/content/developer/reference/standard_modules/account/account_report.rst @@ -9,7 +9,6 @@ Report .. autofield:: line_ids .. autofield:: column_ids .. autofield:: root_report_id - .. autofield:: chart_template_id .. autofield:: country_id .. autofield:: only_tax_exigible .. autofield:: availability_condition diff --git a/content/developer/reference/standard_modules/account/account_tax.rst b/content/developer/reference/standard_modules/account/account_tax.rst index 48a92317f..23b0ef765 100644 --- a/content/developer/reference/standard_modules/account/account_tax.rst +++ b/content/developer/reference/standard_modules/account/account_tax.rst @@ -4,10 +4,9 @@ Taxes ===== -.. automodel:: odoo.addons.account.models.chart_template.AccountTaxTemplate +.. automodel:: odoo.addons.account.models.account_tax.AccountTax :main: - .. autofield:: chart_template_id .. autofield:: name .. autofield:: type_tax_use .. autofield:: tax_scope diff --git a/content/developer/reference/standard_modules/account/account_tax_repartition.rst b/content/developer/reference/standard_modules/account/account_tax_repartition.rst index 8573adf38..254a26239 100644 --- a/content/developer/reference/standard_modules/account/account_tax_repartition.rst +++ b/content/developer/reference/standard_modules/account/account_tax_repartition.rst @@ -4,13 +4,13 @@ Tax Repartitions ================ -.. automodel:: odoo.addons.account.models.chart_template.AccountTaxRepartitionLineTemplate +.. automodel:: odoo.addons.account.models.account_tax.AccountTaxRepartitionLine :main: .. autofield:: factor_percent .. autofield:: repartition_type + .. autofield:: document_type .. autofield:: account_id - .. autofield:: invoice_tax_id - .. autofield:: refund_tax_id + .. autofield:: tax_id .. autofield:: tag_ids .. autofield:: use_in_tax_closing