Odoo Help


How to add Country field as select type in signup page?

on 9/9/15, 1:53 PM 2,885 views

Here i need the following,

1.add country while user signing up in web/signup url.

Here is my code...


<div class="form-group">

<label class="control-label" for="country_id">Country</label>

<select name="country_id" id="country_id" class="form-control">

<option value="">Country...</option>

<t t-foreach="countries or []" t-as="country">

<option t-att-value="country.id" t-att-selected="country.id == auth_signup.get('country_id')"><t t-esc="country.name"/></option>




but it not listing the countries list from res.country

please give any ideas / suggestions

thanks in advance...!

On 11/19/16, 7:54 PM


Thanks @SonnyV, It worked for me,

Here is how to do the same thing in a single line with the new v8 API:

qcontext['countries'] = http.request.env['res.country'].sudo().search([])
On 11/10/15, 10:00 AM

Hello Jothimani

I recently came across this problem and found a solution.

Now, the t-att-selected in your xml option will still fail as auth_signup does not have anything with country-id. I'd just remove the t-att-selected.

You'll have to modify the controller 'main.py' of the module auth_signup. Or inherit it (preferred way)

Then add the following code to the top of the method 'web_auth_signup':

orm_country = request.registry.get('res.country') 
country_ids = orm_country.search(request.cr, SUPERUSER_ID, [], context=request.context)
countries = orm_country.browse(request.cr, SUPERUSER_ID, country_ids, context=request.context)
qcontext = self.get_auth_signup_qcontext() # This line is already present in this method.
qcontext['countries'] = countries
# Paste the rest of the original method here.

Hope my explanation was clear


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 9/9/15, 1:53 PM
Seen: 2885 times
Last updated: 11/19/16, 7:54 PM