[IMP] portal: improved inheritancy when creating a new portal user
bzr revid: qdp-launchpad@openerp.com-20120423164331-2d37425zb2gdk75w
This commit is contained in:
@@ -30,6 +30,18 @@ class res_users(osv.osv):
|
||||
string='Related Partner'),
|
||||
}
|
||||
|
||||
def prepare_new_user_data(self, u, wiz, password):
|
||||
return {
|
||||
'name': u.name,
|
||||
'login': u.user_email,
|
||||
'password': password,
|
||||
'user_email': u.user_email,
|
||||
'context_lang': u.lang,
|
||||
'share': True,
|
||||
'partner_id': u.partner_id and u.partner_id.id,
|
||||
}
|
||||
|
||||
|
||||
res_users()
|
||||
|
||||
|
||||
|
||||
@@ -145,15 +145,8 @@ class wizard(osv.osv_memory):
|
||||
existing_logins = [u.login for u in existing_users]
|
||||
|
||||
# create new users in portal (skip existing logins)
|
||||
new_users_data = [ {
|
||||
'name': u.name,
|
||||
'login': u.user_email,
|
||||
'password': random_password(),
|
||||
'user_email': u.user_email,
|
||||
'context_lang': u.lang,
|
||||
'share': True,
|
||||
'partner_id': u.partner_id and u.partner_id.id,
|
||||
} for u in wiz.user_ids if u.user_email not in existing_logins ]
|
||||
new_users_data = [ user_obj.prepare_new_user_data(u, wiz, random_password())
|
||||
for u in wiz.user_ids if u.user_email not in existing_logins ]
|
||||
portal_obj.write(cr, ROOT_UID, [wiz.portal_id.id],
|
||||
{'users': [(0, 0, data) for data in new_users_data]}, context0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user