Odoo Help

Welcome!

This community 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.

0

Manage City and province localization

By
philip
on 8/30/14, 10:32 PM 1,208 views

Hi all,

I want to localize location, how to achieve like link below in openerp7/odoo

let say, when you select City then in the next field should appear only all the province for that city.

for instance:

 

city1 ------ province1

               province2

               province3

http://www.olx.ph/index.php/select+location/parent/adUpdate/field/location/selected/

 

Thanks

0
philip
On 11/6/14, 12:06 PM

XML

<field name="abs_provinces_id" style="width: 50%%"/>
<field name="abs_cities_id" style="width: 48.2%%" domain="[('abs_provinces_id', '=', abs_provinces_id)]"/>
<field name="abs_zip" placeholder="ZIP" style="width: 8%%" invisible="1"/> 

PYTHON

class abs_provinces(osv.Model):
    _name = "abs.provinces"
    _columns = {
        'name': fields.char('Province', size=32),
    }

class abs_cities(osv.Model):
    _name = "abs.cities"
    _columns = {
        'name': fields.char('City', size=32),
        'abs_provinces_id': fields.many2one('abs.provinces', 'Province'),
    }

0

Bole

--Bole--
2385
| 5 4 6
Zagreb | Karlovac, Croatia
--Bole--

there is only 10 kind of people the ones that understand binary ... and others

Bole
On 11/7/14, 3:12 AM

look for openerp / odoo module named city, it does exactlky that.. 
adds a new model for unique city entriey, conects them to zip codes, states etc... 

also you might want to check python package py-country  , wich contains all countries and states in the world.. 

If you decide to use module city, be aware that it might cause incompatability issues with other custom modules.. 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/30/14, 10:32 PM
Seen: 1208 times
Last updated: 3/16/15, 8:10 AM