我是OpenERP 7的新手,返回树状视图的正确方法是什么?如何返回从我的函数中获得的数据? 这是我的班级代码:
class albaranes_fallidos(osv.osv):
_name = 'albaranes_fallidos'
_inherit = 'stock.picking'
_columns = {}
def find(self, cr, uid, ids, context=None):
stock_picking = self.pool.get('stock.picking')
exist_state = stock_picking.search(cr, uid, [('state','=','confirmed'),('origin','ilike','SO')])
###
exist_lines = stock_picking.browse(cr, uid, exist_state, context)
###
exist_IN = stock_picking.search(cr, uid, [('type','=','in'),('origin','ilike',':SO')])
for SO in exist_lines:
exist_PO = stock_picking.browse(cr, uid, exist_IN, context)
for POSO in exist_PO:
if SO.origin in POSO.origin:
_logger.info(POSO.origin)
break
答案 0 :(得分:0)
您需要使用域来指定要在树视图中加载的记录:
return {
'type': 'ir.actions.act_window',
'name': _('Stock picking'),
'res_model': 'stock.picking',
'view_type': 'form',
'view_mode': 'tree,form',
'target': 'current',
'domain': [('id', 'in', exist_IN)]
}