on_changed メソッドによって返される値に基づいて、2 番目の選択タイプ フィールドにデータを入力したいと考えています。
私のコードはこちら
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}}
_columns = {
'location_dest': fields.selection(_get_location_dest_no_sqlquery,'Division', required=True),
'reference_code': fields.selection(on_change_location_dest,'RIS No.:', required=True),
}
<field name="location_dest" on_change="on_change_location_dest(reference_code)"/>
<newline />
<field name="location_origin" />
<newline />
<field name="reference_code" />
これは可能ですか?