hi all,
i want to add some fields in odoo signup form like: contact_no, address etc. below are the model and controller files, are these OK to achieve this? anything wrong here or i missed something? and what about xml template (view) file, please guide how to add in xml file. and anything i missed or misunderstood...
Model inherit and add required fields
class ResUsersExt(models.Model):
_inherit = 'res.users'
contact_no = fields.Char(string='Contact No.', required=True)
address = fields.Text(string='Address', required=True)
in my module's controllers/main.py (ref: https://www.odoo.com/fr_FR/forum/aide-1/how-to-capture-additional-fields-on-signup-74161)
class AuthSignupHome(AuthSignupHome):
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', 'contact_no', address))
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)
request.cr.commit()
regards