Hello,
Iam working with Odoo 8 and really i tried a lot of solutions before posting my question here.
So, i want to add another field in signup page that post State_id.
This is my file.xml
In my folder "Controllers", i have:<xpath expr="//div[@class='form-group field-confirm_password']" position="after">
<div class="form-group field-country">
<label class="control-label" for="state_id"
style="font-weight: normal">Wilaya
</label>
<select name="state_id" class="form-control">
<option value="">selectionner...</option>
<t t-foreach="states or []" t-as="state">
<option t-att-value="state.id" t-att-selected="state.id == auth_signup.get('state_id')">
<t t-esc="state.name"/>
</option>
</t>
</select>
</div>
</xpath>
And now , i have in my main.py of the folder of Controllers:
_logger = logging.getLogger(__name__)
class AuthSignupHome(openerp.addons.web.controllers.main.Home):
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', 'state_id'))
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()
@http.route('/web/signup', type='http', auth='public', website=True)
def web_auth_signup(self, *args, **kw):
qcontext = self.get_auth_signup_qcontext()
qcontext['states'] = request.env['res.country.state'].sudo().search([])
if not qcontext.get('token') and not qcontext.get('signup_enabled'):
raise werkzeug.exceptions.NotFound()
if 'error' not in qcontext and request.httprequest.method == 'POST':
try:
self.do_signup(qcontext)
return super(AuthSignupHome, self).web_login(*args, **kw)
except (SignupError, AssertionError), e:
if request.env["res.users"].sudo().search([("login", "=", qcontext.get("login"))]):
qcontext["error"] = _("Another user is already registered using this email address.")
else:
_logger.error(e.message)
qcontext['error'] = _("Could not create a new account.")
return request.render('auth_signup.signup', qcontext)
The result is : Internal server Error :
foreach enumerator 'providers' is not defined while rendering template 'auth_oauth.providers'
Can you explain me please? I really need help.