Hello, I hope you are doing well.
I am using Odoo version 16 enterprise edition. I am attempting to add a phone field to the signup page, making it mandatory. Upon user creation, I want to save the field value in 'contacts'. (res.partner.phone) I have tried extensively to bypass 'do_signup', but to no avail, the phone field always remains empty.
Here is the XML code:
And here is the 'main.py' code that I placed in this path: 'my_custom/controllers/main.py'."
from odoo import http
from odoo.http import request
class AuthSignupExtended(http.Controller):
@http.route('/web/signup', type='http', auth='public', website=True, sitemap=False)
def web_auth_signup(self, *args, **kw):
response = super(AuthSignupExtended, self).web_auth_signup(*args, **kw)
if kw.get('phone'):
# Update the partner's phone field with the provided value
partner_id = response.qcontext.get('partner_id')
if partner_id:
partner = request.env['res.partner'].sudo().browse(partner_id)
partner.write({'phone': kw['phone']})
return response
Hi,
I tried your code, but still phone field is not stored, it's empty.
I have extensively researched before writing down my issue. I've started to suspect that the problem might not be in the code. Could there be another reason preventing data storage?