summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorStefan Rijnhart <stefan@opener.am>2017-01-11 17:52:18 +0100
committerMartin Trigaux <mat@odoo.com>2017-01-24 13:39:47 +0100
commitd0ea652221731df119e60d9032b08fda1e9bf817 (patch)
tree2a230b4ba39eaca5b59c3713d168a2432d22035a /addons
parent94807753e7b3a03c94dc6753079851f800c14050 (diff)
[FIX] portal: set a company for portal without one
The field company_id is not required on the res.partner and is used when the portal user is created for portal access. If the partner as no comapny set, the creation crashes (required on the user). Use system default company, with possibility for overwrite. Closes #15030
Diffstat (limited to 'addons')
-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 27bc21835e5..ebd34af2b02 100644
--- a/addons/portal/wizard/portal_wizard.py
+++ b/addons/portal/wizard/portal_wizard.py
@@ -141,7 +141,10 @@ 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:
- company_id = wizard_user.partner_id.company_id.id
+ if wizard_user.partner_id.company_id:
+ company_id = wizard_user.partner_id.company_id.id
+ else:
+ company_id = self.pool['res.company']._company_default_get(cr, uid, 'res.users', context=context)
user_id = self._create_user(cr, SUPERUSER_ID, wizard_user.id, dict(context, company_id=company_id))
else:
user_id = user.id