[FIX] account: fix install of account installs account_accountant

Bug description:

Installing Invoicing on a database whose company is configured in the
SEPA zone, results in installing Accounting

Steps to reproduce on the Runbot:

- Start from a base enterprise database
- Go to Settings > Users & Companies > Companies and configure the
  address of MyCompany to the SEPA zone (e.g. Belgium)
- Go to Apps and install Invoicing
- The Accounting application has been installed

Explanation:

The module account_sepa depends on account_batch_payment, which depends
on account_accountant.
The post_init_hook of account, _auto_install_l10n, adds the account_sepa
module to the installation if the country_code of the company is in the
SEPA zone.
The same side-effect is observed with account_bank_statement_import_camt
which depends on account_bank_statement_import, which depends on
account_accountant.

The fix is to remove the installation of these modules from the
post_init_hook of the module account, and add them to a new
post_init_hook of the module account_accountant, that will be in a PR in
the enterprise project.

closes odoo/odoo#58073

X-original-commit: db4ce56641c75403be935efa072687bff65c7bb2
Related: odoo/enterprise#13362
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
This commit is contained in:
Paul Morelle
2020-09-18 17:35:11 +00:00
parent 0e6a8b5faf
commit 17299012af
-7
View File
@@ -62,13 +62,6 @@ def _auto_install_l10n(env):
if country_code == 'AU':
module_list.append('account_reports_cash_basis')
# SEPA zone countries will be using SEPA
sepa_zone = env.ref('base.sepa_zone', raise_if_not_found=False)
if sepa_zone:
sepa_zone_country_codes = sepa_zone.mapped('country_ids.code')
if country_code in sepa_zone_country_codes:
module_list.append('account_sepa')
module_list.append('account_bank_statement_import_camt')
module_ids = env['ir.module.module'].search([('name', 'in', module_list), ('state', '=', 'uninstalled')])
module_ids.sudo().button_install()