diff options
| author | Stefan Rijnhart <stefan@opener.am> | 2017-01-11 17:52:18 +0100 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2017-01-24 13:39:47 +0100 |
| commit | d0ea652221731df119e60d9032b08fda1e9bf817 (patch) | |
| tree | 2a230b4ba39eaca5b59c3713d168a2432d22035a /addons/portal/wizard | |
| parent | 94807753e7b3a03c94dc6753079851f800c14050 (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/portal/wizard')
| -rw-r--r-- | addons/portal/wizard/portal_wizard.py | 5 |
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 |
