diff options
| author | Adrian Torres <adt@odoo.com> | 2018-02-22 09:17:23 +0100 |
|---|---|---|
| committer | Adrian Torres <adt@odoo.com> | 2018-02-22 09:55:59 +0100 |
| commit | 8e7aaf8c82df80b28fa5f3fc7973ef9e49f29d97 (patch) | |
| tree | 954a7cccae0e8b08ea7f0dfd08504bb3118cafd1 /addons | |
| parent | 97cae87812e60b63d61e09b5974c1e50c316de16 (diff) | |
[FIX] sale_management/account_invoicing: properly reinstall
Commit 985c224 introduced a way to properly uninstall these two modules,
however if a user were to reinstall them the views would stay inactive,
in the case of sale_management this would mean some menus were missing,
in the case of account_invoicing this meant that not even the top-level
menu would not appear, effectively misleading users into thinking the
module was not installed.
The solution is to create a post_init_hook (to ensure that all
potentially missing menus are already installed) that activates the
previously deactivated menus.
Fixes #23245
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account_invoicing/__init__.py | 9 | ||||
| -rw-r--r-- | addons/account_invoicing/__manifest__.py | 1 | ||||
| -rw-r--r-- | addons/sale_management/__init__.py | 9 | ||||
| -rw-r--r-- | addons/sale_management/__manifest__.py | 1 |
4 files changed, 20 insertions, 0 deletions
diff --git a/addons/account_invoicing/__init__.py b/addons/account_invoicing/__init__.py index 91206cf6094..371975a409a 100644 --- a/addons/account_invoicing/__init__.py +++ b/addons/account_invoicing/__init__.py @@ -11,3 +11,12 @@ def uninstall_hook(cr, registry): ('module', '=', 'account') ]).mapped('res_id') env['ir.ui.menu'].browse(res_ids).update({'active': False}) + + +def post_init_hook(cr, registry): + env = Environment(cr, SUPERUSER_ID, {}) + res_ids = env['ir.model.data'].search([ + ('model', '=', 'ir.ui.menu'), + ('module', '=', 'account'), + ]).mapped('res_id') + env['ir.ui.menu'].browse(res_ids).update({'active': True}) diff --git a/addons/account_invoicing/__manifest__.py b/addons/account_invoicing/__manifest__.py index 103f72fdd12..789d02c43d3 100644 --- a/addons/account_invoicing/__manifest__.py +++ b/addons/account_invoicing/__manifest__.py @@ -29,4 +29,5 @@ You could use this simplified accounting in case you work with an (external) acc ], 'application': True, 'uninstall_hook': 'uninstall_hook', + 'post_init_hook': 'post_init_hook', } diff --git a/addons/sale_management/__init__.py b/addons/sale_management/__init__.py index 1b2e5977577..086ab956265 100644 --- a/addons/sale_management/__init__.py +++ b/addons/sale_management/__init__.py @@ -11,3 +11,12 @@ def uninstall_hook(cr, registry): ('module', '=', 'sale') ]).mapped('res_id') env['ir.ui.menu'].browse(res_ids).update({'active': False}) + + +def post_init_hook(cr, registry): + env = Environment(cr, SUPERUSER_ID, {}) + res_ids = env['ir.model.data'].search([ + ('model', '=', 'ir.ui.menu'), + ('module', '=', 'sale'), + ]).mapped('res_id') + env['ir.ui.menu'].browse(res_ids).update({'active': True}) diff --git a/addons/sale_management/__manifest__.py b/addons/sale_management/__manifest__.py index 4202ac31f78..c4584b0acc9 100644 --- a/addons/sale_management/__manifest__.py +++ b/addons/sale_management/__manifest__.py @@ -48,4 +48,5 @@ The Dashboard for the Sales Manager will include ], 'application': True, 'uninstall_hook': 'uninstall_hook', + 'post_init_hook': 'post_init_hook', } |
