Search() should match the sort order of the context language

Bug #645980 reported by Philmer
30
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Confirmed
Wishlist
OpenERP's Framework R&D

Bug Description

In tree form, suppose you have a column with translated terms.
For example :
Draft > Brouillon
Closed > Clôturé
Open > Ouvert
If, in french interface, we order list items by this values, the order take only the english term to order the lines, so we have
first : "Clôturé"
second : "Brouillon"
third : "Ouvert"
confusing in french...

Related branches

Revision history for this message
Richard (John) Nopkins@Servosoft (richard-nopkins) wrote :

words from my developers "problems de read "

Changed in openobject-addons:
status: New → Confirmed
qdp (OpenERP) (qdp)
Changed in openobject-addons:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Medium
affects: openobject-addons → openobject-server
summary: - in Tree form, order doesn't take translation into account
+ Search() should match the sort order of the context language
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

too complex, to be implemented in v6.1

Changed in openobject-server:
importance: Medium → Wishlist
Changed in openobject-server:
milestone: none → 6.1
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi,

We forgot this bug's birthday last week! is any progress being made? The problem still exists in today's trunk.

Cheers,
Stefan.

Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

Hi,

Bug is still in trunk. See screenshot.

Kind regards, Ronald

Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

Screenshot showing the problem in trunk.

In this case I typed "Ne" (to select Nederland, that is dutch for The Netherlands). No Nederland is shown, but a lot of other countries are shown that presumably have "ne" somewhere in their English name.

When I type "Ned" (one letter more), then I am presented with the possibility to select "Nederland"

Ronald

Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

In addition to showing results in the wrong order, the selection done on translated fields is not correct.

For some reason the selection string is not only searched in the translation of the field, but also in the original English term. This can lead to returning results that do not contain the selected string at all!

The SQL executed is for example (statement ormatted for clarity):

SELECT "res_country".id, "res_country".name
    FROM res_country
    WHERE ((res_country."id" IN
        ((SELECT res_id
              FROM ir_translation
              WHERE name = 'res.country,name' AND lang = 'nl_NL'
                AND type = 'model' AND value ilike '%Ne%')
          UNION (SELECT id
              FROM "res_country"
              WHERE "name" ilike '%Ne%')))
      AND (TRUE OR res_country."id" IS NULL))
    ORDER BY name
    LIMIT 8

Apart from this the clause AND (TRUE OR res_country."id" IS NULL) seems to be quite useless. An id field is supposed never to be NULL. Anyway, what would you do with a NULL is field in your search results?

Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

I have created a MERGE requests that contains the most minimal changes to fix the sorting issue. I will submit a second merge request, that will correct (in my opinion it will be a correction) the selection as well, by not searching the original language field.

I think I have also laid the ground work for a much more efficient reading of translated values. A soon as I find the time this will become part of a third merge request.

I include a test script that I used to develop the translation methods used.

Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

As documentation, some of the SQl statements used to analyse the problem

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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