如何填充选择类型字段

时间:2013-10-04 07:35:13

标签: 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 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" />

这可能吗?

0 个答案:

没有答案