Merge lp://staging/~openerp-dev/openobject-server/6.1-bug-1049653-translatable-unaccent-vmt into lp://staging/openobject-server/6.1

Proposed by Vo Minh Thu
Status: Needs review
Proposed branch: lp://staging/~openerp-dev/openobject-server/6.1-bug-1049653-translatable-unaccent-vmt
Merge into: lp://staging/openobject-server/6.1
Diff against target: 27 lines (+12/-5)
1 file modified
openerp/osv/expression.py (+12/-5)
To merge this branch: bzr merge lp://staging/~openerp-dev/openobject-server/6.1-bug-1049653-translatable-unaccent-vmt
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+131198@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Vo Minh Thu (thu) wrote :

Hello Reviewer,

I think it is safe to include this merge prop. in the stable branch. I run some tests and the `if..else` clause is obvious: the else is identical to the original code, and the if depends clearly on the --unaccent flag being given (so in the worst case it should affect only --unaccent users).

If you want to try for yourself the tests, you can paste this code in the product.product YAML tests (i.e. I targeted a translatable field which was located on an inherits'd model):

-
    Unaccent. Create a product with an accent in its name.
-
    !record {model: product.product, id: ymltest_unaccent_product}:
        name: Café
-
    Test the unaccent-enabled 'ilike' on product.
-
    !python {model: product.product}: |
            ids = self.search(cr, uid, [('name','ilike','Cafe')], {})
            assert ids == [ref('ymltest_unaccent_product')], "unaccent on product (1)"
            ids = self.search(cr, uid, [('name','ilike','café')], {})
            assert ids == [ref('ymltest_unaccent_product')], "unaccent on product (2)"
            ids = self.search(cr, uid, [('name','not ilike','Cafe')], {})
            assert ref('ymltest_unaccent_product') not in ids, "unaccent on product (3)"
            ids = self.search(cr, uid, [('name','not ilike','café')], {})
            assert ref('ymltest_unaccent_product') not in ids, "unaccent on product (4)"
-
    Unaccent. Create a product.
-
    !record {model: product.product, id: ymltest_unaccent_product_2}:
        name: Goat
-
    Unaccent. Create a language.
-
    !record {model: res.lang, id: ymltest_lang}:
        name: French
        code: fr_FR
        translatable: True
-
    Unaccent. Create a translation.
-
    !record {model: ir.translation, id: ymltest_translation}:
        name: 'product.template,name'
        lang: fr_FR
        src: 'Goat'
        value: 'Chèvre'
        type: 'model'
        res_id: !eval ref('ymltest_unaccent_product_2')
-
    Test the unaccent-enabled 'ilike' with a translated product name.
-
    !python {model: product.product}: |
            ids = self.search(cr, uid, [('name','ilike','chevre')], context={'lang': 'fr_FR'})
            assert ids == [ref('ymltest_unaccent_product_2')], "translated unaccent on product (1)"

Unmerged revisions

4294. By Vo Minh Thu

[FIX]: expression.py: The unaccent call was missing for translatable fields.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.