[IMP]portal: remove is portal flag
The is_portal flag was used before to define if a group is a portal group. This is not true anymore since the default portal group should be used for this purpose. All logic associated to this flag can be removed. TASK: 47937
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
Dear ${object.user_id.name or ''},
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
Your login account data is:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
<field name="model">portal.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Portal Access Management">
|
||||
<group>
|
||||
<field name="portal_id" widget="selection"/>
|
||||
</group>
|
||||
<div>
|
||||
Select which contacts should belong to the portal in the list below.
|
||||
The email address of each selected contact must be valid and unique.
|
||||
|
||||
@@ -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!')
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
<field name="name">Portal</field>
|
||||
<field name="comment">Portal members have specific access rights (such as record rules and restricted menus).
|
||||
They usually do not belong to the usual Odoo groups.</field>
|
||||
<field name="is_portal" eval="True"/>
|
||||
</record>
|
||||
<!--
|
||||
A group dedicated to the public user only, making groups
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Groups">
|
||||
<field name="name" filter_domain="['|', ('name','ilike',self), ('category_id','ilike',self)]" string="Group"/>
|
||||
<filter name="portal" string="Portal Groups" domain="[('is_portal','=',True)]"/>
|
||||
<filter name="no_portal" string="Non-Portal Groups" domain="[('is_portal','=',False)]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="share"/>
|
||||
<filter name="no_share" string="Internal Groups" domain="[('share','=',False)]"/>
|
||||
@@ -59,7 +57,6 @@
|
||||
<group col="4">
|
||||
<field name="category_id"/>
|
||||
<field name="name"/>
|
||||
<field name="is_portal"/>
|
||||
<field name="share"/>
|
||||
</group>
|
||||
<notebook>
|
||||
|
||||
Reference in New Issue
Block a user