1

我想根据我的 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" />

这可能吗?

4

0 回答 0