overwriting read method breaks group by and sort

Bug #743890 reported by Ferdinand
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
New
Low
OpenERP's Framework R&D
Odoo Web Client
Won't Fix
Undecided
Unassigned

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

Related branches

Revision history for this message
Ferdinand (office-chricar) wrote :
Revision history for this message
xrg (xrg) wrote : Re: [Bug 743890] [NEW] overwriting read method breaks group by and sort

On Monday 28 March 2011, you wrote:
> Public bug reported:
>

> **** opening a category with filtered products crashed GTK
> "/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

Hello Dr,
It may be the same problem that I have fixed two weeks ago about that method:

If so, you should check your function for duplicate IDs.

Revision history for this message
xrg (xrg) wrote :

On Monday 28 March 2011, you wrote:
> On Monday 28 March 2011, you wrote:
> > Public bug reported:
> >
> >
> > **** opening a category with filtered products crashed GTK
> > "/sw/home/gass/OpenERP/trunk/openobject-client/6.0/bin/widget/view/list.p
> > y ", line 307, in on_iter_next i = node.list_group.lst.index(node) + 1
>
> Hello Dr,
> It may be the same problem that I have fixed two weeks ago about that
> method:
Oops, the link didn't appear:
http://git.hellug.gr/?p=xrg/openobject-
client;a=commit;h=e91495f24010d271417229bb93d

> If so, you should check your function for duplicate IDs.

Revision history for this message
Ferdinand (office-chricar) wrote :

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()

Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
xrg (xrg) wrote : Re: [Bug 743890] Re: overwriting read method breaks group by and sort

On Monday 28 March 2011, you wrote:
> IMHO it's the contrary - missing ids
>
You're right.
I was able to reproduce the crash with /my/ Gtk client. Investigating now.

--
Say NO to spam and viruses. Stop using Microsoft Windows!

xrg (xrg)
Changed in openobject-server:
status: Confirmed → Fix Committed
Revision history for this message
Ferdinand (office-chricar) wrote :

a similar problem exists for web-client -
all categories are used for grouping, even if no lines are inside
but it does not crash opening empty groups

- nevertheless - I think the number of records in a group should be displayed like in GTK - this helps

Revision history for this message
xrg (xrg) wrote :

On Wednesday 30 March 2011, you wrote:
> a similar problem exists for web-client -
> all categories are used for grouping, even if no lines are inside
> but it does not crash opening empty groups
>
> - nevertheless - I think the number of records in a group should be
> displayed like in GTK - this helps
>

Well, the source of the problem is that you've tried to override read(),
instead of doing that to search().

I just fixed the Gtk client not to crash. Then, we would have to find a better
way to limit these zero-quantity products.

--
Say NO to spam and viruses. Stop using Microsoft Windows!

Revision history for this message
Ferdinand (office-chricar) wrote :

overwriting the search (see attached module) returns correct results, but group by category and sort give the same results as overwriting read()

Changed in openobject-server:
status: Fix Committed → New
Changed in openobject-client-web:
assignee: nobody → OpenERP SA's Web Client R&D (openerp-dev-web)
status: New → Triaged
Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) wrote :

Thanks a lot for reporting this bug and contributing to OpenERP. Unfortunately the OpenERP Web Client project is not going to be developed further after the 6.0 series. As of 6.1 a newer and better web frontend known as the OpenERP Web project[1] will be available.
Our R&D developers normally work in Launchpad to fix bugs for the next release, but there will be no next release for the current OpenERP Web Client. As our resources are limited, all further R&D efforts from the Web team are dedicated to finish the new 6.1 OpenERP Web project[1].
This bug will be closed as "Won't Fix" to show that R&D won't be able to work on it.

Bugs affecting customers in production of course continue to be handled via the OpenERP Enterprise (OPW) maintenance service, and this is the recommended way to have them corrected directly in the 6.0 LTS stable branch.
You can find more details about all of this in the FAQ of our Bug Management Policy documentation[2].

If you are interested, you should soon be able to beta-test the new OpenERP Web 6.1 (this will be announced on OpenERP Community channels).

Thank you for your contributions and for your understanding!

[1] https://launchpad.net/openerp-web
[2] http://bit.ly/openerp-bugs-faq (FAQ #4)

Changed in openobject-client-web:
assignee: OpenERP R&D Web Team (openerp-dev-web) → nobody
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.