Hello,
I have to create a module. In this one, users have to complete two informations, in a menu "fields.selection" : Firstly, they have to complete the department (part of a country). Then, when the department is choosen, the menu "Towns" must display only towns situated in this department. This is the line in my XML file :
Code:
<field name="id_dep" on_change="onchange_departement(id_dep)"/>
And my function "onchange" :
Code:
def onchange_departement(self, cr, uid, ids, id_dep):
v={}
list_towns={}
if id_dep!=False:
sql="""
SELECT ville_name
FROM cpratik_villes
WHERE dpt_id=%s
"""
cr.execute(sql, (id_dep,))
list_towns = cr.fetchall()
v['id_ville']=list_towns
return {'value':v}
When I try to execute this code, I see on my selection box only one town, instead of the list of towns in the choosen department.
Does someone know where is the problem and how can I resolve it ? Thank you very much in advance.
Mistycal