Skip to Content
Menú
This question has been flagged
4367 Vistes

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" />
Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de març 15
3974
1
de març 25
1194
0
de nov. 24
1431
0
de juny 24
1489
1
de juny 24
1979