diff options
| author | qdp-odoo <qdp@odoo.com> | 2015-09-07 17:12:43 +0200 |
|---|---|---|
| committer | qdp-odoo <qdp@odoo.com> | 2015-09-07 17:12:46 +0200 |
| commit | 108e424baf0d09c522668a9ed9261530e1216d04 (patch) | |
| tree | bde23cea2a334ce669a6fc0efbd4d7216b48e33b /addons/account/__init__.py | |
| parent | 3bf8e5970ffe0994956f821e349603c5a7dbc4e2 (diff) | |
[IMP] account: auto_install localization module(s) if the country is known
Diffstat (limited to 'addons/account/__init__.py')
| -rw-r--r-- | addons/account/__init__.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/addons/account/__init__.py b/addons/account/__init__.py index 1c0b2504154..e1e75bd53ad 100644 --- a/addons/account/__init__.py +++ b/addons/account/__init__.py @@ -5,3 +5,24 @@ import models import wizard import report +from openerp import SUPERUSER_ID + +def _auto_install_l10n(cr, registry): + #check the country of the main company (only) and eventually load some module needed in that country + country_code = registry['res.users'].browse(cr, SUPERUSER_ID, SUPERUSER_ID, {}).company_id.country_id.code + if country_code: + #auto install localization module(s) if available + module_list = [] + if country_code in ['BJ', 'BF', 'CM', 'CF', 'KM', 'CG', 'CI', 'GA', 'GN', 'GW', 'GQ', 'ML', 'NE', 'CD', 'SN', 'TD', 'TG']: + #countries using OHADA Chart of Accounts + module_list.append('l10n_syscohada') + else: + module_list.append('l10n_' + country_code.lower()) + if country_code == 'US': + module_list.append('account_plaid') + if country_code in ['US', 'AU', 'NZ']: + module_list.append('account_yodlee') + + module_ids = registry['ir.module.module'].search(cr, SUPERUSER_ID, [('name', 'in', module_list), ('state', '=', 'uninstalled')]) + registry['ir.module.module'].button_install(cr, SUPERUSER_ID, module_ids, {}) + |
