首先先谢谢digitalsatori,
意思大概清楚了,但是:
def _get_product_available_func(states, what):<br /> def _product_available(self, cr, uid, ids, name, arg, context=None):<br /> return {}.fromkeys(ids, 0.0)<br /> return _product_available<br /><br /> _product_qty_available = _get_product_available_func(('done',), ('in', 'out'))<br /> _product_virtual_available = _get_product_available_func(('confirmed','waiting','assigned','done'), ('in', 'out'))<br /> _product_outgoing_qty = _get_product_available_func(('confirmed','waiting','assigned'), ('out',))<br /> _product_incoming_qty = _get_product_available_func(('confirmed','waiting','assigned'), ('in',))<br />
对于def _get_product_available_func(states, what):
def _product_available(self, cr, uid, ids, name, arg, context=None):
return {}.fromkeys(ids, 0.0)
return _product_available
如何取数据库数据不明白, return {}.fromkeys(ids, 0.0)实际上是初始化, 比如product id = 1 {}.fromkeys(ids,0) = {1:0.0}, 在这里没有看到执行汇总, 或查询记录, 所以另人费解