[IMP] auth_signup : add hook to add custom fields

closes odoo/odoo#65276

Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
This commit is contained in:
Florent de Labarre
2021-01-29 21:35:14 +00:00
parent e09cb7a27d
commit 145d48d23b
+6 -2
View File
@@ -116,8 +116,7 @@ class AuthSignupHome(Home):
qcontext['invalid_token'] = True
return qcontext
def do_signup(self, qcontext):
""" Shared helper that creates a res.partner out of a token """
def _prepare_signup_values(self, qcontext):
values = { key: qcontext.get(key) for key in ('login', 'name', 'password') }
if not values:
raise UserError(_("The form was not properly filled in."))
@@ -127,6 +126,11 @@ class AuthSignupHome(Home):
lang = request.context.get('lang', '')
if lang in supported_lang_codes:
values['lang'] = lang
return values
def do_signup(self, qcontext):
""" Shared helper that creates a res.partner out of a token """
values = self._prepare_signup_values(qcontext)
self._signup_with_values(qcontext.get('token'), values)
request.env.cr.commit()