diff --git a/addons/portal/data/portal_data.xml b/addons/portal/data/portal_data.xml index ffe12934227..6539d154080 100644 --- a/addons/portal/data/portal_data.xml +++ b/addons/portal/data/portal_data.xml @@ -15,7 +15,7 @@ Dear ${object.user_id.name or ''},

- You have been given access to ${user.company_id.name}'s ${object.wizard_id.portal_id.name}. + You have been given access to ${user.company_id.name}'s portal.

Your login account data is: diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py index 0c8206c86f6..c96eb169915 100644 --- a/addons/portal/wizard/portal_wizard.py +++ b/addons/portal/wizard/portal_wizard.py @@ -29,16 +29,7 @@ class PortalWizard(models.TransientModel): _name = 'portal.wizard' _description = 'Portal Access Management' - def _default_portal(self): - return self.env['res.groups'].search([('is_portal', '=', True)], limit=1) - - portal_id = fields.Many2one('res.groups', domain=[('is_portal', '=', True)], required=True, string='Portal', - default=_default_portal, help="The portal that users can be added in or removed from.") - user_ids = fields.One2many('portal.wizard.user', 'wizard_id', string='Users') - welcome_message = fields.Text('Invitation Message', help="This text is included in the email sent to new users of the portal.") - - @api.onchange('portal_id') - def onchange_portal_id(self): + def _default_user_ids(self): # for each partner, determine corresponding portal.wizard.user records partner_ids = self.env.context.get('active_ids', []) contact_ids = set() @@ -51,13 +42,16 @@ class PortalWizard(models.TransientModel): contact_ids.add(contact.id) in_portal = False if contact.user_ids: - in_portal = self.portal_id in contact.user_ids[0].groups_id + in_portal = self.env.ref('base.group_portal') in contact.user_ids[0].groups_id user_changes.append((0, 0, { 'partner_id': contact.id, 'email': contact.email, 'in_portal': in_portal, })) - self.user_ids = user_changes + return user_changes + + user_ids = fields.One2many('portal.wizard.user', 'wizard_id', string='Users',default=_default_user_ids) + welcome_message = fields.Text('Invitation Message', help="This text is included in the email sent to new users of the portal.") @api.multi def action_apply(self): @@ -125,9 +119,9 @@ class PortalWizardUser(models.TransientModel): raise UserError("\n\n".join(error_msg)) for wizard_user in self.sudo().with_context(active_test=False): - group_portal = wizard_user.wizard_id.portal_id - if not group_portal.is_portal: - raise UserError(_('Group %s is not a portal') % group_portal.name) + + group_portal = self.env.ref('base.group_portal') + #Checking if the partner has a linked user user = wizard_user.partner_id.user_ids[0] if wizard_user.partner_id.user_ids else None # update partner email, if a new one was introduced if wizard_user.partner_id.email != wizard_user.email: diff --git a/addons/portal/wizard/portal_wizard_views.xml b/addons/portal/wizard/portal_wizard_views.xml index 909b822cf8d..5a234ea68ec 100644 --- a/addons/portal/wizard/portal_wizard_views.xml +++ b/addons/portal/wizard/portal_wizard_views.xml @@ -15,9 +15,6 @@ portal.wizard

- - -
Select which contacts should belong to the portal in the list below. The email address of each selected contact must be valid and unique. diff --git a/odoo/addons/base/models/res_users.py b/odoo/addons/base/models/res_users.py index 2915d9a0086..12e04b119e9 100644 --- a/odoo/addons/base/models/res_users.py +++ b/odoo/addons/base/models/res_users.py @@ -85,7 +85,6 @@ class Groups(models.Model): color = fields.Integer(string='Color Index') full_name = fields.Char(compute='_compute_full_name', string='Group Name', search='_search_full_name') share = fields.Boolean(string='Share Group', help="Group created to set access rights for sharing data with some users.") - is_portal = fields.Boolean('Portal', help="If checked, this group is usable as a portal.") _sql_constraints = [ ('name_uniq', 'unique (category_id, name)', 'The name of the group must be unique within an application!') diff --git a/odoo/addons/base/security/base_groups.xml b/odoo/addons/base/security/base_groups.xml index 88c0be2729a..4e02e99ed2a 100644 --- a/odoo/addons/base/security/base_groups.xml +++ b/odoo/addons/base/security/base_groups.xml @@ -57,7 +57,6 @@ Portal Portal members have specific access rights (such as record rules and restricted menus). They usually do not belong to the usual Odoo groups. -