diff --git a/addons/portal/wizard/share_wizard.py b/addons/portal/wizard/share_wizard.py index b5c9d165cc6..7d84270bd5b 100644 --- a/addons/portal/wizard/share_wizard.py +++ b/addons/portal/wizard/share_wizard.py @@ -114,7 +114,7 @@ class share_wizard_portal(osv.osv_memory): # In both cases, we call super() to create the share group, but when # sharing with existing groups, we will later delete it, and copy its # access rights and rules to the selected groups. - group_id = super(share_wizard_portal,self)._create_share_users_group(cr, uid, wizard_data, context=context) + super_result = super(share_wizard_portal,self)._create_share_users_group(cr, uid, wizard_data, context=context) # For sharing with existing groups, we don't create a share group, instead we'll # alter the rules of the groups so they can see the shared data @@ -137,10 +137,10 @@ class share_wizard_portal(osv.osv_memory): wizard_data.write({'result_line_ids': [(0,0,new_line)]}) elif wizard_data.user_ids: - # must take care of existing users, by adding them to the new group, which is group_ids[0], + # must take care of existing users, by adding them to the new group, which is super_result[0], # and adding the shortcut selected_user_ids = [x.id for x in wizard_data.user_ids] - self.pool.get('res.users').write(cr, UID_ROOT, selected_user_ids, {'groups_id': [(4,group_id)]}) + self.pool.get('res.users').write(cr, UID_ROOT, selected_user_ids, {'groups_id': [(4, super_result[0])]}) self._setup_action_and_shortcut(cr, uid, wizard_data, selected_user_ids, make_home=False, context=context) # populate the result lines for existing users too for user in wizard_data.user_ids: @@ -148,7 +148,7 @@ class share_wizard_portal(osv.osv_memory): 'newly_created': False} wizard_data.write({'result_line_ids': [(0,0,new_line)]}) - return group_id + return super_result def copy_share_group_access_and_delete(self, cr, wizard_data, share_group_id, context=None): # In the case of sharing with existing groups, the strategy is to copy diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index 07004f333a8..b0b6a06a0cb 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -668,7 +668,8 @@ class share_wizard(osv.osv_memory): """Creates the appropriate share group and share users, and populates result_line_ids of wizard_data with one line for each user. - :return: the new group id (to which the shared access should be granted) + :return: a tuple composed of the new group id (to which the shared access should be granted), + the ids of the new share users that have been created and the ids of the existing share users """ group_id = self._create_share_group(cr, uid, wizard_data, context=context) # First create any missing user, based on the email addresses provided @@ -739,7 +740,7 @@ class share_wizard(osv.osv_memory): all_relations = obj0 + obj1 + obj2 self._link_or_copy_current_user_rules(cr, current_user, group_id, all_relations, context=context) # B. - main_domain = wizard_data.domain if wizard_data.domain != '[]' else DOMAIN_ALL + main_domain = wizard_data.domain if wizard_data.domain != '[]' else str(DOMAIN_ALL) self._create_or_combine_sharing_rule(cr, current_user, wizard_data, group_id, model_id=model.id, domain=main_domain, restrict=True, context=context)