Hi,
How to define default country in webshop checkout form?
Odoo is the world's easiest all-in-one management software.
 It includes hundreds of business apps:
Hi,
How to define default country in webshop checkout form?
In file /usr/lib/python2.7/dist-packages/openerp/addons/website_sale/controllers/main.py
find strings
        # Default search by user country
        if not checkout.get('country_id'):
            country_code = request.session['geoip'].get('country_code')
            if country_code:
                country_ids = request.registry.get('res.country').search(cr, uid, [('code', '=', country_code)], context=context)
                if country_ids:
                    checkout['country_id'] = country_ids[0]
than, if you wan to "hardcode" default contry, do somthing like this
        # Default search by user country
        if not checkout.get('country_id'):
            checkout['country_id'] = 231 #hardcode Ukraine #country_ids[0]
            #country_code = request.session['geoip'].get('country_code')
            #if country_code:
            #    country_ids = request.registry.get('res.country').search(cr, uid, [('code', '=', country_code)], context=context)
            #    if country_ids:
            #        checkout['country_id'] = country_ids[0]
Other country id`s you can find in database
SELECT *   FROM res_country;
Also you must understand that this is a dirty hack and it will disapeared after yuo update odoo.
 
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up| Related Posts | Replies | Views | Activity | |
|---|---|---|---|---|
| 
            
                Nested tree view
            
            
                    Solved
            
         |  | 2 जुल॰ 16  | 9257 | |
|  | 1 फ़र॰ 18  | 13389 | ||
|  | 1 मई 16  | 6587 | ||
|  | 0 जून 15  | 4602 | ||
|  | 0 मई 17  | 9787 |