From 145d48d23be13fc1debb004694cb836992bc4f44 Mon Sep 17 00:00:00 2001 From: Florent de Labarre Date: Fri, 29 Jan 2021 14:31:26 +0000 Subject: [PATCH] [IMP] auth_signup : add hook to add custom fields closes odoo/odoo#65276 Signed-off-by: Olivier Dony (odo) --- addons/auth_signup/controllers/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index d4eb9ec7ec4..9bca10e9da1 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -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()