Openerp 如何填充选择类型字段

Openerp 如何填充选择类型字段,openerp,Openerp,我想根据on_changed方法返回的值填充第二个选择类型字段 这是我的密码 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

我想根据on_changed方法返回的值填充第二个选择类型字段

这是我的密码

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" />
def on_change_location_dest(self、cr、uid、id、location_dest、context=None):
x={}
x=位置\目的地
sql_res=cr.execute(“选择sm.picking_id,sp.name from stock_move sm internal join stock_picking sp on sm.picking_id=sp.id,其中sm.location_dest_id=“+str(x))
res=cr.fetchall()
返回{'value':{'reference_code':res}
_列={
“location\u dest”:fields.selection(\u get\u location\u dest\u no\u sqlquery,'Division',required=True),
“参考代码”:字段。选择(在“更改位置”目的地,“RIS编号:”,必需=True),
}
这可能吗