summaryrefslogtreecommitdiff
path: root/addons/portal/wizard
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2016-07-26 12:24:16 +0200
committerGoffin Simon <sig@odoo.com>2016-07-26 13:26:59 +0200
commit7e1b0792da8e4cc330cdffa705871c769b08d3b3 (patch)
tree012781b86ab772e308c91c23aca6fbeb0d6804c8 /addons/portal/wizard
parentd94183ff97f8efb9379b468123bd9062948b5ae3 (diff)
[FIX] portal: creating a user portal for a partner
Steps to reproduce the bug: -Create two companies A and B where A is the parent of B -Admin is in A -Demo is in B -Create a partner P with Demo -Create a user portal for P with Demo Bug: Access error due to the fact that the user portal created for P was created in SUPER_USER with company_ids and company_id set with the same inforamtions as with Admin. Fix: company_ids and company_id must be set with the company of Partner P opw:682930
Diffstat (limited to 'addons/portal/wizard')
-rw-r--r--addons/portal/wizard/portal_wizard.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py
index 13e2d4830a2..ccef7eb0bd5 100644
--- a/addons/portal/wizard/portal_wizard.py
+++ b/addons/portal/wizard/portal_wizard.py
@@ -139,7 +139,8 @@ class wizard_user(osv.osv_memory):
user_id = False
# create a user if necessary, and make sure it is in the portal group
if not user:
- user_id = self._create_user(cr, SUPERUSER_ID, wizard_user.id, context)
+ company_id = wizard_user.partner_id.company_id.id
+ user_id = self._create_user(cr, SUPERUSER_ID, wizard_user.id, dict(context, company_id=company_id))
else:
user_id = user.id
wizard_user.write({'user_id': user_id})
@@ -167,6 +168,8 @@ class wizard_user(osv.osv_memory):
res_users = self.pool.get('res.users')
create_context = dict(context or {}, noshortcut=True, no_reset_password=True) # to prevent shortcut creation
values = {
+ 'company_id': context.get('company_id'),
+ 'company_ids': [(6, 0, [context.get('company_id')])],
'email': extract_email(wizard_user.email),
'login': extract_email(wizard_user.email),
'partner_id': wizard_user.partner_id.id,