Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4370 Lượt xem

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" />
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 15
3974
1
thg 3 25
1199
0
thg 11 24
1431
0
thg 6 24
1490
1
thg 6 24
1981