[IMP] portal: simplify portal access management wizard
bzr revid: rco@openerp.com-20120917132212-wo2wrjzja0xsuys8
This commit is contained in:
parent
7d93e8077d
commit
6dc01c405b
|
@ -25,6 +25,7 @@ import random
|
||||||
from osv import osv, fields
|
from osv import osv, fields
|
||||||
from tools.translate import _
|
from tools.translate import _
|
||||||
from tools.misc import email_re
|
from tools.misc import email_re
|
||||||
|
from openerp import SUPERUSER_ID
|
||||||
|
|
||||||
from base.res.res_partner import _lang_get
|
from base.res.res_partner import _lang_get
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
@ -48,8 +49,6 @@ OpenERP - Open Source Business Applications
|
||||||
http://www.openerp.com
|
http://www.openerp.com
|
||||||
""")
|
""")
|
||||||
|
|
||||||
ROOT_UID = 1
|
|
||||||
|
|
||||||
# character sets for passwords, excluding 0, O, o, 1, I, l
|
# character sets for passwords, excluding 0, O, o, 1, I, l
|
||||||
_PASSU = 'ABCDEFGHIJKLMNPQRSTUVWXYZ'
|
_PASSU = 'ABCDEFGHIJKLMNPQRSTUVWXYZ'
|
||||||
_PASSL = 'abcdefghijkmnpqrstuvwxyz'
|
_PASSL = 'abcdefghijkmnpqrstuvwxyz'
|
||||||
|
@ -70,277 +69,157 @@ def extract_email(email):
|
||||||
|
|
||||||
class wizard(osv.osv_memory):
|
class wizard(osv.osv_memory):
|
||||||
"""
|
"""
|
||||||
A wizard to create portal users from instances of 'res.partner'. The purpose
|
A wizard to manage the creation/removal of portal users.
|
||||||
is to provide an OpenERP database access to customers or suppliers.
|
|
||||||
"""
|
"""
|
||||||
_name = 'res.portal.wizard'
|
_name = 'portal.wizard'
|
||||||
_description = 'Portal Wizard'
|
_description = 'Portal Access Management'
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'partner_id': fields.many2one('res.partner', required=True, string="Partner"),
|
'partner_id': fields.many2one('res.partner', required=True, string="Partner"),
|
||||||
'portal_id': fields.many2one('res.groups', domain=[('is_portal', '=', True)], required=True,
|
'portal_id': fields.many2one('res.groups', domain=[('is_portal', '=', True)], required=True,
|
||||||
string='Portal',
|
string='Portal', help="The portal that users can be added in or removed from."),
|
||||||
help="The portal in which new users must be added"),
|
'user_ids': fields.one2many('portal.wizard.user', 'wizard_id', string='Users'),
|
||||||
'user_ids': fields.one2many('res.portal.wizard.user', 'wizard_id',
|
'message': fields.text(string='Invitation Message',
|
||||||
string='Users'),
|
help="This text is included in the welcome email sent to the users."),
|
||||||
'message': fields.text(string='Invitation message',
|
|
||||||
help="This text is included in the welcome email sent to the users"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def default_get(self, cr, uid, fields, context=None):
|
def _default_partner(self, cr, uid, context):
|
||||||
if context is None:
|
return context and context.get('active_id') or False
|
||||||
context = {}
|
|
||||||
partner_id = context.get('active_id', False)
|
|
||||||
portal_id = context.get('portal_id', False)
|
|
||||||
res = {}
|
|
||||||
if not partner_id:
|
|
||||||
return res
|
|
||||||
|
|
||||||
if 'partner_id' in fields:
|
def _default_portal(self, cr, uid, context):
|
||||||
res.update({'partner_id': partner_id})
|
portal_ids = self.pool.get('res.groups').search(cr, uid, [('is_portal', '=', True)])
|
||||||
|
return portal_ids and portal_ids[0] or False
|
||||||
if 'user_ids' in fields and portal_id:
|
|
||||||
user_ids = self.get_portal_users(cr, uid, [partner_id], portal_id, context=context)
|
|
||||||
res.update({'user_ids': user_ids})
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
_defaults = {
|
||||||
|
'partner_id': _default_partner,
|
||||||
|
'portal_id': _default_portal,
|
||||||
|
}
|
||||||
|
|
||||||
def onchange_portal_id(self, cr, uid, ids, partner_id, portal_id, context=None):
|
def onchange_portal_id(self, cr, uid, ids, partner_id, portal_id, context=None):
|
||||||
if not portal_id:
|
assert partner_id
|
||||||
return {'value': {}}
|
# for each partner, determine corresponding portal.wizard.user records
|
||||||
user_list = self.get_portal_users(cr, uid, [partner_id], portal_id, context=context)
|
|
||||||
return {'value': {'user_ids': user_list}}
|
|
||||||
|
|
||||||
|
|
||||||
def _search_partner_user(self, cr, uid, partner_id, context=None):
|
|
||||||
res_user = self.pool.get('res.users')
|
|
||||||
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
|
|
||||||
if partner.parent_id:
|
|
||||||
user_ids = res_user.search(cr, uid, [('login','=',partner.email)])
|
|
||||||
else:
|
|
||||||
user_ids = res_user.search(cr, uid, [('partner_id','=', partner.id)])
|
|
||||||
return user_ids
|
|
||||||
|
|
||||||
def _search_portal_user(self, cr, uid, partner_id, context=None):
|
|
||||||
res_user = self.pool.get('res.users')
|
|
||||||
res_partner = self.pool.get('res.partner')
|
res_partner = self.pool.get('res.partner')
|
||||||
partner = res_partner.browse(cr, uid, partner_id, context=context)
|
partner_ids = [partner_id]
|
||||||
user_ids = res_user.search(cr, uid, [('login','=',partner.email)])
|
user_changes = []
|
||||||
user_id = False
|
for partner in res_partner.browse(cr, SUPERUSER_ID, partner_ids, context):
|
||||||
if user_ids and len(user_ids):
|
for contact in (partner.child_ids or [partner]):
|
||||||
user_id = user_ids[0]
|
in_portal = False
|
||||||
return user_id
|
if contact.user_ids:
|
||||||
|
in_portal = portal_id in [g.id for g in contact.user_ids[0].groups_id]
|
||||||
|
user_changes.append((0, 0, {
|
||||||
|
'partner_id': contact.id,
|
||||||
|
'email': contact.email,
|
||||||
|
'in_portal': in_portal,
|
||||||
|
}))
|
||||||
|
return {'value': {'user_ids': user_changes}}
|
||||||
|
|
||||||
def _portal_user_dict(self, cr, uid, partner, portal_id, context=None):
|
def action_apply(self, cr, uid, ids, context=None):
|
||||||
res_user = self.pool.get('res.users')
|
wizard = self.browse(cr, uid, ids[0], context)
|
||||||
users = []
|
portal_user_ids = [user.id for user in wizard.user_ids]
|
||||||
if partner.parent_id:
|
self.pool.get('portal.wizard.user').action_apply(cr, uid, portal_user_ids, context)
|
||||||
lang = partner.parent_id.lang or 'en_US'
|
|
||||||
company_id = partner.parent_id.id
|
|
||||||
else:
|
|
||||||
lang = partner.lang or 'en_US'
|
|
||||||
company_id = partner.id
|
|
||||||
|
|
||||||
def _portal_user(address):
|
|
||||||
if not self._search_portal_user(cr, uid, address.id, context=context):
|
|
||||||
if address.email:
|
|
||||||
users.append({
|
|
||||||
'name': address.name,
|
|
||||||
'email': extract_email(address.email),
|
|
||||||
'lang': lang or 'en_US',
|
|
||||||
'partner_id': company_id,
|
|
||||||
'has_portal_user': False,
|
|
||||||
})
|
|
||||||
|
|
||||||
if not partner.child_ids:
|
|
||||||
_portal_user(partner)
|
|
||||||
for address in partner.child_ids:
|
|
||||||
_portal_user(address)
|
|
||||||
partner_user_ids = self._search_partner_user(cr, uid, partner.id, context=context)
|
|
||||||
portal_users = [u.id for u in self.pool.get('res.groups').browse(cr, uid, portal_id, context=context).users]
|
|
||||||
for user in res_user.browse(cr, uid, partner_user_ids, context=context):
|
|
||||||
email = user and user.email or False
|
|
||||||
has_portal_user = False
|
|
||||||
if user.id in portal_users:
|
|
||||||
has_portal_user = True
|
|
||||||
|
|
||||||
if email:
|
|
||||||
users.append({
|
|
||||||
'name': user and user.name,
|
|
||||||
'email': email and extract_email(email) or False,
|
|
||||||
'lang': lang or 'en_US',
|
|
||||||
'partner_id': company_id,
|
|
||||||
'has_portal_user': has_portal_user,
|
|
||||||
'user_id': user.id,
|
|
||||||
})
|
|
||||||
return users
|
|
||||||
|
|
||||||
def get_portal_users(self, cr, uid, partner_ids, portal_id, context=None):
|
|
||||||
users = []
|
|
||||||
res_partner = self.pool.get('res.partner')
|
|
||||||
for partner in res_partner.browse(cr, uid, partner_ids, context=context):
|
|
||||||
users.extend(self._portal_user_dict(cr, uid, partner, portal_id, context=context))
|
|
||||||
return users
|
|
||||||
|
|
||||||
|
|
||||||
def action_manage_portal_access(self, cr, uid, ids, context=None):
|
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
clone_context = context
|
|
||||||
clone_context['noshortcut'] = True # prevent shortcut creation
|
|
||||||
context = dict(clone_context)
|
|
||||||
res_portal_user = self.pool.get('res.portal.wizard.user')
|
|
||||||
for data in self.browse(cr, uid, ids, context=context):
|
|
||||||
if not data.user_ids:
|
|
||||||
raise osv.except_osv(_('User required'),
|
|
||||||
_('Create atleast one user for portal.'))
|
|
||||||
portal_user_ids = [user.id for user in data.user_ids]
|
|
||||||
res_portal_user.manage_portal_access(cr, uid, portal_user_ids, context=context)
|
|
||||||
return {'type': 'ir.actions.act_window_close'}
|
return {'type': 'ir.actions.act_window_close'}
|
||||||
wizard()
|
|
||||||
|
|
||||||
class wizard_user(osv.osv_memory):
|
class wizard_user(osv.osv_memory):
|
||||||
"""
|
"""
|
||||||
A model to configure users in the portal wizard.
|
A model to configure users in the portal wizard.
|
||||||
"""
|
"""
|
||||||
_name = 'res.portal.wizard.user'
|
_name = 'portal.wizard.user'
|
||||||
_description = 'Portal User Config'
|
_description = 'Portal User Config'
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'wizard_id': fields.many2one('res.portal.wizard', required=True,
|
'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True),
|
||||||
string='Wizard'),
|
'partner_id': fields.many2one('res.partner', string='Contact', required=True, readonly=True),
|
||||||
'name': fields.char(size=64, required=True,
|
'email': fields.related('partner_id', 'email', type='char', string='Email'),
|
||||||
string='User Name',
|
'in_portal': fields.boolean('In Portal'),
|
||||||
help="The user's real name"),
|
|
||||||
'email': fields.char(size=64, required=True,
|
|
||||||
string='Email',
|
|
||||||
help="Will be used as user login. "
|
|
||||||
"Also necessary to send the account information to new users"),
|
|
||||||
'lang': fields.selection(_lang_get, required=True,
|
|
||||||
string='Language',
|
|
||||||
help="The language for the user's user interface"),
|
|
||||||
'partner_id': fields.related('wizard_id','partner_id',type='many2one',relation='res.partner',string='Partner',readonly=True),
|
|
||||||
'has_portal_user':fields.boolean('Has portal access'),
|
|
||||||
'user_id': fields.many2one('res.users', string="Related User")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def _check_email(self, cr, uid, ids):
|
def action_apply(self, cr, uid, ids, context=None):
|
||||||
""" check syntax of email address """
|
|
||||||
for wuser in self.browse(cr, uid, ids):
|
|
||||||
if not email_re.match(wuser.email): return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
_constraints = [
|
|
||||||
(_check_email, 'Invalid email address', ['email']),
|
|
||||||
]
|
|
||||||
|
|
||||||
_defaults = {
|
|
||||||
'lang': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).partner_id.lang or 'en_US',
|
|
||||||
'partner_id': lambda self, cr, uid, ctx: ctx.get('active_id', False),
|
|
||||||
}
|
|
||||||
|
|
||||||
def send_email(self, cr, uid, portal_user, new_user_id, context=None):
|
|
||||||
#TODO: use email template
|
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
ctx = dict(context)
|
|
||||||
res_users = self.pool.get('res.users')
|
res_users = self.pool.get('res.users')
|
||||||
mail_mail = self.pool.get('mail.mail')
|
for wizard_user in self.browse(cr, SUPERUSER_ID, ids, context):
|
||||||
user = res_users.browse(cr, ROOT_UID, uid, context)
|
portal = wizard_user.wizard_id.portal_id
|
||||||
|
user = self._retrieve_user(cr, SUPERUSER_ID, wizard_user, context)
|
||||||
|
if wizard_user.in_portal:
|
||||||
|
# create a user if necessary, and make sure it is in the portal group
|
||||||
|
if not user:
|
||||||
|
user = self._create_user(cr, SUPERUSER_ID, wizard_user, context)
|
||||||
|
if (not user.active) or (portal not in user.groups_id):
|
||||||
|
user.write({'active': True, 'groups_id': [(4, portal.id)]})
|
||||||
|
wizard_user = self.browse(cr, SUPERUSER_ID, wizard_user.id, context)
|
||||||
|
self._send_email(cr, uid, wizard_user, context)
|
||||||
|
else:
|
||||||
|
# remove the user (if it exists) from the portal group
|
||||||
|
if user:
|
||||||
|
if portal in user.groups_id:
|
||||||
|
values = {'groups_id': [(3, portal.id)]}
|
||||||
|
if len(user.groups_id) == 1:
|
||||||
|
values['active'] = False # deactivate user
|
||||||
|
user.write(values)
|
||||||
|
|
||||||
|
def _retrieve_user(self, cr, uid, wizard_user, context=None):
|
||||||
|
""" retrieve the (possibly inactive) user corresponding to wizard_user.partner_id
|
||||||
|
@param wizard_user: browse record of model portal.wizard.user
|
||||||
|
@return: browse record of model res.users
|
||||||
|
"""
|
||||||
|
if wizard_user.partner_id.user_ids:
|
||||||
|
return wizard_user.partner_id.user_ids[0]
|
||||||
|
# the user may be inactive, search for it
|
||||||
|
res_users = self.pool.get('res.users')
|
||||||
|
domain = [('partner_id', '=', wizard_user.partner_id.id), ('active', '=', False)]
|
||||||
|
user_ids = res_users.search(cr, uid, domain)
|
||||||
|
return user_ids and res_users.browse(cr, uid, user_ids[0], context) or False
|
||||||
|
|
||||||
|
def _create_user(self, cr, uid, wizard_user, context=None):
|
||||||
|
""" create a new user for wizard_user.partner_id
|
||||||
|
@param wizard_user: browse record of model portal.wizard.user
|
||||||
|
@return: browse record of model res.users
|
||||||
|
"""
|
||||||
|
res_users = self.pool.get('res.users')
|
||||||
|
create_context = dict(context or {}, noshortcut=True) # to prevent shortcut creation
|
||||||
|
values = {
|
||||||
|
'login': wizard_user.email,
|
||||||
|
'password': random_password(),
|
||||||
|
'partner_id': wizard_user.partner_id.id,
|
||||||
|
'groups_id': [(6, 0, [])],
|
||||||
|
'share': True,
|
||||||
|
}
|
||||||
|
user_id = res_users.create(cr, uid, values, context=create_context)
|
||||||
|
return res_users.browse(cr, uid, user_id, context)
|
||||||
|
|
||||||
|
def _send_email(self, cr, uid, wizard_user, context=None):
|
||||||
|
""" send invitation email to a new portal user
|
||||||
|
@param wizard_user: browse record of model portal.wizard.user
|
||||||
|
@return: the id of the created mail.mail record
|
||||||
|
"""
|
||||||
|
user = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid, context)
|
||||||
if not user.email:
|
if not user.email:
|
||||||
raise osv.except_osv(_('Email required'),
|
raise osv.except_osv(_('Email required'),
|
||||||
_('You must have an email address in your User Preferences'
|
_('You must have an email address in your User Preferences to send emails.'))
|
||||||
' to send emails.'))
|
|
||||||
|
# determine subject and body in the portal user's language
|
||||||
record = portal_user.wizard_id
|
portal_user = wizard_user.partner_id.user_ids[0]
|
||||||
subject_data = {
|
main_context = context
|
||||||
'company': user.company_id.name,
|
context = dict(main_context or {}, lang=portal_user.lang)
|
||||||
|
data = {
|
||||||
|
'company': user.company_id.name,
|
||||||
|
'portal': wizard_user.wizard_id.portal_id.name,
|
||||||
|
'message': wizard_user.wizard_id.message or "",
|
||||||
|
'url': _("(missing url)"),
|
||||||
|
'db': cr.dbname,
|
||||||
|
'login': portal_user.login,
|
||||||
|
'password': portal_user.password,
|
||||||
|
'name': portal_user.name
|
||||||
}
|
}
|
||||||
new_user = res_users.browse(cr, uid, new_user_id, context=context)
|
subject = _(WELCOME_EMAIL_SUBJECT) % data
|
||||||
ctx['lang'] = new_user.lang
|
body = _(WELCOME_EMAIL_BODY) % data
|
||||||
body_data = {
|
|
||||||
'portal': record.portal_id.name,
|
mail_mail = self.pool.get('mail.mail')
|
||||||
'message': record.message or "",
|
mail_values = {
|
||||||
'url': record.portal_id.url or _("(missing url)"),
|
'email_from': user.email,
|
||||||
'db': cr.dbname,
|
'email_to': portal_user.email,
|
||||||
'login': new_user.login,
|
'subject': subject,
|
||||||
'password': new_user.password,
|
'body_html': '<pre>%s</pre>' % body,
|
||||||
'name': new_user.name
|
'state': 'outgoing',
|
||||||
}
|
}
|
||||||
body_data.update(subject_data)
|
return mail_mail.create(cr, uid, mail_values, context=main_context)
|
||||||
email_from = user.email
|
|
||||||
email_to = portal_user.email
|
|
||||||
subject = _(WELCOME_EMAIL_SUBJECT) % subject_data
|
|
||||||
body = _(WELCOME_EMAIL_BODY) % body_data
|
|
||||||
mail_id = mail_mail.create(cr, uid, {
|
|
||||||
'email_from': email_from ,
|
|
||||||
'email_to': email_to,
|
|
||||||
'subject': subject,
|
|
||||||
'state': 'outgoing',
|
|
||||||
'body_html': '<pre>%s</pre>' % body}, context=ctx)
|
|
||||||
return mail_id
|
|
||||||
|
|
||||||
def create_new_user(self, cr, uid, portal_user, context=None):
|
|
||||||
res_user = self.pool.get('res.users')
|
|
||||||
portal = portal_user.wizard_id.portal_id
|
|
||||||
partner = portal_user.partner_id
|
|
||||||
action_id = portal.home_action_id and portal.home_action_id.id or False
|
|
||||||
value = {
|
|
||||||
'name': portal_user.name,
|
|
||||||
'login': portal_user.email,
|
|
||||||
'password': random_password(),
|
|
||||||
'email': portal_user.email,
|
|
||||||
'lang': portal_user.lang,
|
|
||||||
'share': True,
|
|
||||||
'action_id': action_id,
|
|
||||||
'partner_id': partner.id,
|
|
||||||
'groups_id': [(6, 0, [])],
|
|
||||||
}
|
|
||||||
user_id = res_user.create(cr, ROOT_UID, value, context=context)
|
|
||||||
portal_user.write({'user_id': user_id})
|
|
||||||
self.send_email(cr, uid, portal_user, user_id, context=context)
|
|
||||||
return user_id
|
|
||||||
|
|
||||||
def link_portal_user(self, cr, uid, portal_id, user_id, context=None):
|
|
||||||
res_groups = self.pool.get('res.groups')
|
|
||||||
portal = res_groups.browse(cr, uid, portal_id, context=context)
|
|
||||||
portal_user_ids = [u.id for u in portal.users]
|
|
||||||
if user_id not in portal_user_ids:
|
|
||||||
return portal.write({'users': [(4, user_id)]}, context=context)
|
|
||||||
if user_id in portal_user_ids:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def unlink_portal_user(self, cr, uid, portal_id, user_id, context=None):
|
|
||||||
res_groups = self.pool.get('res.groups')
|
|
||||||
return res_groups.write(cr, uid, [portal_id], {'users': [(3, user_id)]}, context=context)
|
|
||||||
|
|
||||||
def unlink_user(self, cr, uid, user_id, context=None):
|
|
||||||
#TODO: search portal groups
|
|
||||||
res_user = self.pool.get('res.users')
|
|
||||||
user = res_user.browse(cr, uid, user_id, context=context)
|
|
||||||
if not user.groups_id:
|
|
||||||
user.unlink(context=context)
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def manage_portal_access(self, cr, uid, ids, context=None):
|
|
||||||
res_user = self.pool.get('res.users')
|
|
||||||
for portal_user in self.browse(cr, uid, ids, context=context):
|
|
||||||
portal = portal_user.wizard_id.portal_id
|
|
||||||
user_id = portal_user.user_id and portal_user.user_id.id
|
|
||||||
if not user_id:
|
|
||||||
user_ids = res_user.search(cr, uid, [('login','=',portal_user.email)])
|
|
||||||
user_id = user_ids and user_ids[0] or False
|
|
||||||
|
|
||||||
if not user_id:
|
|
||||||
user_id = self.create_new_user(cr, uid, portal_user, context=context)
|
|
||||||
linked = self.link_portal_user(cr, uid, portal.id, user_id, context=context)
|
|
||||||
#unlink existing user into portal
|
|
||||||
if not linked and not portal_user.has_portal_user:
|
|
||||||
self.unlink_portal_user(cr, uid, portal.id, user_id, context=context)
|
|
||||||
#drop user if it does not has any access in any portal.
|
|
||||||
self.unlink_user(cr, uid, user_id, context=context)
|
|
||||||
return True
|
|
||||||
wizard_user()
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<act_window id="partner_wizard_action"
|
<act_window id="partner_wizard_action"
|
||||||
name="Portal Access Management"
|
name="Portal Access Management"
|
||||||
src_model="res.partner"
|
src_model="res.partner"
|
||||||
res_model="res.portal.wizard"
|
res_model="portal.wizard"
|
||||||
view_type="form" view_mode="form"
|
view_type="form" view_mode="form"
|
||||||
key2="client_action_multi" target="new"
|
key2="client_action_multi" target="new"
|
||||||
groups="base.group_partner_manager"/>
|
groups="base.group_partner_manager"/>
|
||||||
|
@ -13,18 +13,18 @@
|
||||||
<!-- wizard view -->
|
<!-- wizard view -->
|
||||||
<record id="wizard_view" model="ir.ui.view">
|
<record id="wizard_view" model="ir.ui.view">
|
||||||
<field name="name">Portal Access Management</field>
|
<field name="name">Portal Access Management</field>
|
||||||
<field name="model">res.portal.wizard</field>
|
<field name="model">portal.wizard</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Portal Access Management" version="7.0">
|
<form string="Portal Access Management" version="7.0">
|
||||||
<group>
|
<group>
|
||||||
<field name="partner_id" invisible="1"/>
|
<field name="partner_id" invisible="1"/>
|
||||||
<field name="portal_id" widget="selection" on_change="onchange_portal_id(partner_id, portal_id)"/>
|
<field name="portal_id" widget="selection" on_change="onchange_portal_id(partner_id, portal_id)"/>
|
||||||
</group>
|
</group>
|
||||||
|
<label string="Fill in check boxes below to determine which contacts should belong to the portal."/>
|
||||||
<field name="user_ids"/>
|
<field name="user_ids"/>
|
||||||
<field name="message" placeholder="This text will be included in the welcome email sent to users."/>
|
<field name="message" placeholder="This text will be included in the welcome email sent to users."/>
|
||||||
<footer>
|
<footer>
|
||||||
<button string="Apply"
|
<button string="Apply" name="action_apply" type="object" class="oe_highlight"/>
|
||||||
name="action_manage_portal_access" type="object" class="oe_highlight" />
|
|
||||||
or
|
or
|
||||||
<button string="Cancel" class="oe_link" special="cancel" />
|
<button string="Cancel" class="oe_link" special="cancel" />
|
||||||
</footer>
|
</footer>
|
||||||
|
@ -35,33 +35,15 @@
|
||||||
<!-- wizard user list view -->
|
<!-- wizard user list view -->
|
||||||
<record id="wizard_user_tree_view" model="ir.ui.view">
|
<record id="wizard_user_tree_view" model="ir.ui.view">
|
||||||
<field name="name">Portal Users</field>
|
<field name="name">Portal Users</field>
|
||||||
<field name="model">res.portal.wizard.user</field>
|
<field name="model">portal.wizard.user</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<!-- the attribute 'editable' is set below to make the elements
|
<!-- the contact list is editable, but one cannot add or delete rows -->
|
||||||
editable in the web client 6.0 -->
|
<tree string="Contacts" editable="bottom" create="false" delete="false">
|
||||||
<tree string="Portal Users" editable="bottom">
|
|
||||||
<field name="name"/>
|
|
||||||
<field name="email"/>
|
|
||||||
<field name="partner_id"/>
|
<field name="partner_id"/>
|
||||||
<field name="has_portal_user"/>
|
<field name="email"/>
|
||||||
|
<field name="in_portal"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- wizard user form view -->
|
|
||||||
<record id="wizard_user_form_view" model="ir.ui.view">
|
|
||||||
<field name="name">Portal User</field>
|
|
||||||
<field name="model">res.portal.wizard.user</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<form string="Portal User" version="7.0">
|
|
||||||
<group colspan="2" col="2">
|
|
||||||
<field name="name"/>
|
|
||||||
<field name="email"/>
|
|
||||||
<field name="lang"/>
|
|
||||||
<field name="partner_id"/>
|
|
||||||
</group>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
Loading…
Reference in New Issue