2
對odoo我是嘗試onchange。條件是,在我插入數據如「SO00012」後,我的代碼將嘗試通過插入代碼瀏覽數據。這裏是我的代碼:odoo onchange沒有得到數據
def onchange_data(self, cr, uid, vals, ids, context=None):
stocks_picking_onchange = self.browse(cr, uid)
products = []
stiks = self.browse(cr, uid, ids)
objk = self.pool.get('purchase.order')
objeck = self.pool.get('data.stock.picking')
objecks = objk.search(cr, uid,[('name','=',stiks.origin)])
datas = objk.browse(cr, uid, objecks)
if datas:
for data in datas:
for line in data.order_line:
products.append((0, 0, {
'data1': line.id,
'data2' : line.product_qty,
'data3' : line.bonus,
}))
,但我從來沒有得到過的數據,我的朋友sugges我來添加方法來創建這樣的:
def onchange_data(self, cr, uid, vals, ids, context=None):
res = super(stock_picking, self).create(cr, uid, vals, context=context)
stocks_picking_onchange = self.browse(cr, uid)
products = []
但是,它還是老樣子不工作
我沒有看到* onchange()*方法中的return語句。 –