From 085bf6d02fd0644ab80ec0fc34bfc8908b10710d Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Thu, 5 May 2011 19:07:20 +0200 Subject: [PATCH] [FIX] share: share users with multi-shares should keep same home action Previously they were assigned the generic menu as home action but that is not very relevant because it does not contain their shortcuts most of the time, and also this breaks the web client in v6.0 as it does not support the Menu as home action. bzr revid: odo@openerp.com-20110505170720-k0p7pjfkyadzc4pg --- addons/share/wizard/share_wizard.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index 43448b09141..6ea97ed9b11 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -221,16 +221,18 @@ class share_create(osv.osv_memory): def _setup_action_and_shortcut(self, cr, uid, wizard_data, user_ids, new_users, context=None): """Create a shortcut to reach the shared data, as well as the corresponding action, for - each user in ``user_ids``, and assign it as their home action.""" + each user in ``user_ids``, and assign it as their home action. + Meant to be overridden for special cases. + """ user_obj = self.pool.get('res.users') - menu_action_id = user_obj._get_menu(cr, uid, context=context) + values = self._shared_action_def(cr, uid, wizard_data, context=None) for user_id in user_ids: - values = self._shared_action_def(cr, uid, wizard_data, context=None) action_id = self._create_shortcut(cr, user_id, values) if new_users: + # We do this only for new share users, as existing ones already have their initial home + # action. Resetting to the default menu does not work well as the menu is rather empty + # and does not contain the shortcuts in most cases. user_obj.write(cr, UID_ROOT, [user_id], {'action_id': action_id}) - else: - user_obj.write(cr, UID_ROOT, [user_id], {'action_id': menu_action_id}) def _get_recursive_relations(self, cr, uid, model, ttypes, relation_fields=None, suffix=None, context=None): """Returns list of tuples representing recursive relationships of type ``ttypes`` starting from