The default signup form has fields for Email, Name, Password, and Confirm Password. I want to add the phone number.
I created a custom module and was able to override the HTML form to add the phone input tag.
But the only way I could get it to save to the DB was to manually change addons/auth_signup/controller/main.py
def do_signup(self, qcontext):
""" Shared helper that creates a res.partner out of a token """
values = dict((key, qcontext.get(key)) for key in ('login', 'name', 'password'))
assert any([k for k in values.values()]), "The form was not properly filled in."
assert values.get('password') == qcontext.get('confirm_password'), "Passwords do not match; please retype them."
self._signup_with_values(qcontext.get('token'), values)
The line causing the issue is values = dict((key, qcontext.get(key)) for key in ('login', 'name', 'password')). If I edit this line and add 'phone' after 'password' it works as expected.
My question is how can I make this change in a custom module instead of hard-coding the change in this file?
@Gary,
You definitely can and should make these changes in a custom module as opposed to editing core modules/files.
Could you post the files you have edited on a github gist or repo so that I can take a look?
From what I understand you simply want to add a phone number field to the signup process that will save to the customer's related partner profile after they signup, is that correct?
Luke, thanks for the comment. I was able to get the phone number to save by overriding the method in my custom module as shown below.