class product_product(osv.osv):
_inherit = "product.product"
# FIXME this returns correct records, but group by catagory ignores this and uses all results for grouping
# opening a category crashes
def read(self,cr, uid, ids, fields=None, context=None, load='_classic_read'):
res_all = super(product_product, self).read(cr,uid, ids, fields, context, load='_classic_read')
res = []
if context.get('display_with_zero_qty') == False:
for prod in res_all:
qty = prod.get('qty_available')
vir = prod.get('virtual_available')
if qty <> 0.0 or vir <> 0.0: res.append(prod)
else:
res = res_all
# FIXME - result should be sorted by name
# http://wiki.python.org/moin/SortingListsOfDictionaries - returns (unicode?) error on name
return res
product_product()
IMHO it's the contrary - missing ids
class product_ product( osv.osv) :
_inherit = "product.product"
# FIXME this returns correct records, but group by catagory ignores this and uses all results for grouping classic_ read'): product, self).read(cr,uid, ids, fields, context, load='_ classic_ read') get('display_ with_zero_ qty') == False: 'qty_available' ) 'virtual_ available' )
res.append( prod) wiki.python. org/moin/ SortingListsOfD ictionaries - returns (unicode?) error on name
# opening a category crashes
def read(self,cr, uid, ids, fields=None, context=None, load='_
res_all = super(product_
res = []
if context.
for prod in res_all:
qty = prod.get(
vir = prod.get(
if qty <> 0.0 or vir <> 0.0:
else:
res = res_all
# FIXME - result should be sorted by name
# http://
return res
product_product()