How can I display values on my second selection field type based on the value of the first selection field type. Example,
- First Selection has values
{('1','Stock'),('2','Output')}
. - Second selection should display values depending on the key of my first selection.
Code:
def on_change_location_dest(self, cr, uid, ids, location_dest, context=None):
x = {}
x = location_dest
sql_res = cr.execute("select sm.picking_id, sp.name from stock_move sm inner join stock_picking sp on sm.picking_id = sp.id where sm.location_dest_id=" + str(x))
res = cr.fetchall()
return {'value':{'reference_code': res}}
#I have a method that populates my first selection field
'location_dest': fields.selection(_get_location_dest_,'Division', required=True),
'reference_code': fields.selection(on_change_location_dest,'RIS No.:', required=True),
# When on_change method is triggered, It should populate my second selection ---It's not happening.
<field name="location_dest" on_change="on_change_location_dest(reference_code)"/>
<newline />
<field name="reference_code" />