[FIX] account: do not install l10n_generic_coa if another is installed

The module l10n_generic_coa was installed in every single case when
loading a new db from the console because the country is US by default.
If we have a `-i l10n_*`, we dont need to install another CoA based on
the country.
The fact that it is installed was messing with the demo data because we
were searching for a type of account not necessary present in the CoA
installed on the company.

closes odoo/odoo#52190

X-original-commit: d3ad353c86f7b148946f9e36457f6b002cc118c1
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: wan <william-andre@users.noreply.github.com>
This commit is contained in:
william
2020-05-29 15:24:37 +00:00
parent af949fc27d
commit fef6e133a0
+8 -4
View File
@@ -16,8 +16,13 @@ def _auto_install_l10n(cr, registry):
country_code = env.company.country_id.code
if country_code:
#auto install localization module(s) if available
to_install_l10n = env['ir.module.module'].search_count([('name', 'like', 'l10n_'), ('state', '=', 'to install')])
module_list = []
if country_code in SYSCOHADA_LIST:
if to_install_l10n:
# We don't install a CoA if one was passed in the command line
# or has been selected to install
pass
elif country_code in SYSCOHADA_LIST:
#countries using OHADA Chart of Accounts
module_list.append('l10n_syscohada')
elif country_code == 'GB':
@@ -32,9 +37,8 @@ def _auto_install_l10n(cr, registry):
module_list.append('l10n_generic_coa')
if country_code == 'US':
module_list.append('account_plaid')
module_list.append('l10n_us_check_printing')
if country_code == 'CA':
module_list.append('l10n_ca_check_printing')
if country_code in ['US', 'CA']:
module_list.append('account_check_printing')
if country_code in ['US', 'AU', 'NZ', 'CA', 'CO', 'EC', 'ES', 'FR', 'IN', 'MX', 'GB']:
module_list.append('account_yodlee')
if country_code in SYSCOHADA_LIST + [