can not sort columns

Bug #394711 reported by Ferdinand
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
KDE OpenObject Client
New
Wishlist
Unassigned

Bug Description

openobject-client-kde> bzr revno 787

the indicator changes but the result is not sorted

affects: openobject-client-web → openobject-client-kde
Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

Sorting does work, but you can't sort relation, one2many, many2many or many2one fields. That should be supported by the server (model's search() function), which currently isn't. A patch for that would be surely welcomed.

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

can not sort any column of custom reports

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote : Re: [Bug 394711] Re: can not sort columns

A Dimecres, 8 de juliol de 2009, Ferdinand @ ChriCar va escriure:
> can not sort any column of custom reports

That's because the server doesn't provide sorting for them. As already
mentioned, by default, Koo relies on server side sorting which is what it
allows it to virtually show all records. Nothing we can do there. The only
thing you can do is configure Koo to "Sort Visible Records", but that, of
course, will make it only load 80 records each time, not all of them.

--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18

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

re: "can't sort relation, one2many, many2many or many2one fields"
IMHO it will be difficult to explain/"sell" users why sort does not work as "expected"
it's a huge usability issue.

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

A Dilluns, 13 de juliol de 2009, Ferdinand @ ChriCar va escriure:
> re: "can't sort relation, one2many, many2many or many2one fields"
> IMHO it will be difficult to explain/"sell" users why sort does not work as
> "expected" it's a huge usability issue.

Sure. But how do you explain them that they need to paginate and moving from
one page to another doesn't respect sorting either?

--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18

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

IMHO - if things do not behave as users expect a message should pop up
"... currently sort is not possible for ....."
this is not a solution but avoids questions and (negative) feedback

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

Right. I commited an improvement which informs in the status bar if the field was not sortable. I don't want to use a blocking message for this as it might get really annoying. I consider the rest as a wishlist for future improvements.

Changed in openobject-client-kde:
importance: Undecided → Wishlist
Revision history for this message
Ferdinand (office-chricar) wrote :

Hmm
* Sorting only groups - means "sort by id" ?
* clicking on a "function field" seems to restore the default sort order + issues the message "sorting not possible"

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

A Dilluns, 20 de juliol de 2009, Ferdinand @ ChriCar va escriure:
> Hmm
> * Sorting only groups - means "sort by id" ?

Yes. I think it's clearer for the user.

> * clicking on a "function field" seems to restore the default sort order +
> issues the message "sorting not possible"

Yes, I'll take a look at this.

--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18

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

sorry to be back with this issue

the "sort by id issue" for foreign key fields

is really a very very big usability issue

it does not conform to anything users are used to......

may be this issue has to be fixed together with Tiny - because we need a reliable sort mechanism including translated strings

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

sorry to say it's really a showstopper

when it comes to sort functional fields by id -> chaotic order ..user must think it's borken ..:-((

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

A Dissabte, 1 d'agost de 2009, Ferdinand @ ChriCar va escriure:
> sorry to say it's really a showstopper
>
> when it comes to sort functional fields by id -> chaotic order ..user
> must think it's borken ..:-((

You can sort functional fields indeed. You should set store=True if you want
them to be sorted. I'll work on a solution for many2one fields. What I think
would be great is that OpenObject server could be configured to store ALL
functional fields (even those which have store=False).

--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18

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

Yes - I can set store=True for "my" apps , but not for all OpenERP

IMHO it needs a popup to inform the user if sort is problematic

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

A Dissabte, 1 d'agost de 2009, Ferdinand @ ChriCar va escriure:
> Yes - I can set store=True for "my" apps , but not for all OpenERP

As I said, it be great if OpenERP provided a means to set store=True, when
it's False, that would solve the problem. Meanwhile, this trivial patch should
do:

=== modified file 'bin/osv/fields.py'
--- bin/osv/fields.py 2009-04-27 18:17:01 +0000
+++ bin/osv/fields.py 2009-08-01 11:42:29 +0000
@@ -588,7 +588,7 @@
 #
 # multi: compute several fields in one call
 #
- def __init__(self, fnct, arg=None, fnct_inv=None, fnct_inv_arg=None,
type='float', fnct_search=None, obj=None, method=False, store=False,
multi=False, **args):
+ def __init__(self, fnct, arg=None, fnct_inv=None, fnct_inv_arg=None,
type='float', fnct_search=None, obj=None, method=False, store=True,
multi=False, **args):
         _column.__init__(self, **args)
         self._obj = obj
         self._method = method

>
> IMHO it needs a popup to inform the user if sort is problematic

--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18

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

doing so the server does not start any more

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

A Dissabte, 1 d'agost de 2009, Ferdinand @ ChriCar va escriure:
> doing so the server does not start any more

I guess, this will only work for newly created databases. Otherwise, the
server expects to find several fields in the database, which have not been
created.

--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

A Dissabte, 1 d'agost de 2009, Ferdinand @ ChriCar va escriure:
> sorry to say it's really a showstopper
>
> when it comes to sort functional fields by id -> chaotic order ..user
> must think it's borken ..:-((

Right. Just commited r907. Given that this had to be carried out in the server
I added a new service in the 'koo' module. So if you have the module installed
you'll be able to sort by many2one fields. Drawbacks:

- Just like in other cases, if many2one "name" field is a function it won't be
sorted. You'll need store=True for that.
- Translatable fields are sorted by the default (english) language. OpenObject
doesn't support this either so I think a bug or blueprint should be reported
to the project.

If 'koo' module is not installed behaviour is exactly the same as it was. If
users don't like it, they can use GTK-like behaviour by loading only 80 rows.

--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18

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

thanks - yes this is a great functionality now :-)

a little thing
the busy cursor should change to normal only AFTER the display has been refreshed
during backup periods our connections are extreamly busy - good for testing slow lines

the cursor changes back to normal and only after 2-5 seconds the screen shows the sorted data.
I clicked sometimes during this period , ebcaus I thought nothing happens.

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

We are using product + variants in farming
so the product is wheat or potatoes - the variant are the different brands
OpenERP 5.0 offers just products - no template form

the user wants to see the ist of products ordered product_template.name,variants
to get this I added a functional field to product_product which stores product_template name and added an _order clause product_template_name,variants
we do not use codes.

this works fine for GKT/WEB, but not for koo - at least once I have clicked on one of the 2 column to sort.

interesting - I get sort ascending on clicking on product name, but not descending.
the variants are never sorted.

may be koo can get an option, "use default sort" which uses the order clause of py.

I think products are essential

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

A Dilluns, 10 d'agost de 2009, Ferdinand @ ChriCar va escriure:
> We are using product + variants in farming
> so the product is wheat or potatoes - the variant are the different brands
> OpenERP 5.0 offers just products - no template form
>
> the user wants to see the ist of products ordered
> product_template.name,variants to get this I added a functional field to
> product_product which stores product_template name and added an _order
> clause product_template_name,variants we do not use codes.
>
> this works fine for GKT/WEB, but not for koo - at least once I have
> clicked on one of the 2 column to sort.
>
> interesting - I get sort ascending on clicking on product name, but not
> descending. the variants are never sorted.
>
> may be koo can get an option, "use default sort" which uses the order
> clause of py.
>
> I think products are essential

If the function field is not stored, it can't be sorted and then the default
"_order" is used. Trying to invert the order, won't work either, of course.

--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18

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

Of course I do not know the internals, but not beeing able to sort columns for whatever reason, looks like a show stopper.
Users just do not understand it.

So I strongly suggest to sort columns localy if server side sorting is not available.

It's sort of basic WYSIWYG

IMHO good sorting is one of the bigest issues in OpenERP

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

A Dissabte, 12 de setembre de 2009, Ferdinand @ ChriCar va escriure:
> Of course I do not know the internals, but not beeing able to sort columns
> for whatever reason, looks like a show stopper. Users just do not
> understand it.

If that's a show stopper for you, then use client side sorting with the limit
of records loaded from the server.

> So I strongly suggest to sort columns localy if server side sorting is
> not available.

That's not possible because usually NOT all records are loaded. They're loaded
on demand.

> It's sort of basic WYSIWYG
>
> IMHO good sorting is one of the bigest issues in OpenERP

--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18

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

even if I set "sort visible"
certain "name get" and similar are not sorted

     def name_get(self, cr, uid, ids, context={}):
              if not len(ids):
                       return []
              #reads = self.read(cr, uid, ids, ['name','location_id'])
              reads = self.read(cr, uid, ids, [])
              res = []
              for record in reads:
                       top = record['name']
                       staircase = record['staircase']
                       floor = record['floor']
                       surface = ''
                       if record['surface'] > 0.0:
                           surface = ' [' + str(record['surface']) + u'm²]'
                       location = record['location_id'][1]

                       name = location + ' - ' + staircase + '/' + floor + '/' + top + surface

                       res.append((record['id'], name))
              return res

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

r1153 sort works for m2o and m2m but not for o2m yet ?

Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

Neither m2m nor o2m work, and I don't know if/when we'll implement those. It's not a matter of complexity but a matter of performance.

Revision history for this message
Ferdinand (office-chricar) wrote :
Revision history for this message
Albert Cervera i Areny - http://www.NaN-tic.com (albert-nan) wrote :

A Divendres, 13 de novembre de 2009, Ferdinand @ ChriCar va escriure:
> Then I do not understand your comment here
> http://bazaar.launchpad.net/~openobject-client-kde/openobject-client-kde/5.
> 0/revision/1153
>

I quote the comment you mention:

"Ensure SortingVisibleItems mode works properly. This includes using
SortAllItems mode in OneToMany and ManyToMany fields, so we set
SortingAllItems the default mode for RecordGroup and change it only when
needed: FormWidget and SearchDialog."

What this patch fixes is the use of "SortingVisibleItems" mode. This mode
behaves like the gtk client by loading only the first X (80, by default)
records. The comment says that this mode is not used in OneToMany and
ManyToMany fields because it would mean that even if a partner had 100
addresses, only the first 80 would be loaded.

It has nothing to do with sorting of o2m and m2m in "SortAllItems" mode (which
is the default).

--
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18

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

sorting columns confuses me

sorting mode - all items (which should make it as default ASAP - IMHO)

Example:
configuring Full Text Indexes - sort Model
* click tells me - "Sorting not possible"
* after some more clicks - the column gets sorted alphabetically

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

sorting m2o with overwritten get_name behind dows not sort either
I just put it here because someone mentioned the other day on a mailing list "sorting works"

may be it should be made more explicit which sort work and what not (yet)

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

"sorting not possible" (related and function fields)
Example Partner:
sort of City, Country not possible

pls implement a workaround like
* downlaod all
* sort local

it's difficult to explain to users why this does not "work"
thanks

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.