c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #20223
[Bug 743890] Re: overwriting read method breaks group by and sort
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
# 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()
** Attachment added: "category.png"
https://bugs.launchpad.net/openobject-server/+bug/743890/+attachment/1948550/+files/category.png
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/743890
Title:
overwriting read method breaks group by and sort
Status in OpenERP Server:
New
Bug description:
the attached module retuns only a list of products with qty(s) != 0.0, which IMHO should become a standard - especially important
* as OpenERP can not filter function fields for now
* in multi stock locations the user is mostly only interested to see products in stock at a specific location.
the attached module returns
* all products in the prodct list
* default only products with quantities (on request all) for "Location Structure"
**2 problems
*** click on sort on the name changes the number of lines returned
*** group by catagory -
**** returns catagories of ALL products (WRONG)
**** opening a category with filtered products crashed GTK
Traceback (most recent call last):
File "/sw/home/gass/OpenERP/trunk/openobject-client/6.0/bin/widget/view/list.py", line 307, in on_iter_next
i = node.list_group.lst.index(node) + 1
IMHO the search window does not take into account the reduced set of
data returned by the new read method
Follow ups
References