求助:' list' object can not be callable
-
大家好,我新建了一个wizard,
主要功能是,从'stock.production.lot',选择一项,读取当前行的数据,然后把这个数据用create方法写到另一个Object里,
但是报错 ' list' object can not be callable
我想错误应该在 pick = picking_obj.browse(cr, uid, data['id'], context) 这一句里,但是不知道应该如何修改!
还请大家帮忙!
def _sample2_create(obj, cr, uid, data, context):
picking_obj=pooler.get_pool(cr.dbname).get('stock.production.lot')
pick = picking_obj.browse(cr, uid, data['id'], context) # 参照 stock/wizard/wizard_invoice_onshipping.py 写的
tracking_id=self.pool.get('stock.tracking').create(cr, uid, {
'orderline_id': pick.orderline_id,
'prodlot_id': pick.id,
# add real batch NO into vichical lot
'realbatch': pick.realbatch,
'serial': ref,
'state': 'wait',
} )
return tracking_id
##########################################################################################################################################
class wizard_stock_sample2_create(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'action', 'action': [_sample2_create], 'state':'end'}
}
}
wizard_stock_sample2_create('stock.sample2.create') -
错误太多了,代码可以模仿,但是主要是要理解代码的含义。
self.pool.get('stock.tracking')
pick.orderline_id,
'action': [_sample2_create],
还有你的return,有什么特殊意义?