Code review comment for lp:~openerp-dev/openobject-server/6.1-bug-1049653-translatable-unaccent-vmt

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

« Back to merge proposal