Merge lp:~openerp-dev/openobject-server/6.1-bug-1049653-translatable-unaccent-vmt into lp:openobject-server/6.1
Proposed by
Vo Minh Thu
Status: | Needs review | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~openerp-dev/openobject-server/6.1-bug-1049653-translatable-unaccent-vmt | ||||
Merge into: | lp: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:~openerp-dev/openobject-server/6.1-bug-1049653-translatable-unaccent-vmt | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+131198@code.launchpad.net |
To post a comment you must log in.
Unmerged revisions
- 4294. By Vo Minh Thu
-
[FIX]: expression.py: The unaccent call was missing for translatable fields.
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_ product} : ,'ilike' ,'Cafe' )], {}) unaccent_ product' )], "unaccent on product (1)" ,'ilike' ,'café' )], {}) unaccent_ product' )], "unaccent on product (2)" unaccent_ product' ) not in ids, "unaccent on product (3)" unaccent_ product' ) not in ids, "unaccent on product (4)" unaccent_ product_ 2}:
translatable: True translation} : template, name' unaccent_ product_ 2') ,'ilike' ,'chevre' )], context={'lang': 'fr_FR'}) unaccent_ product_ 2')], "translated unaccent on product (1)"
Unaccent. Create a product with an accent in its name.
-
!record {model: product.product, id: ymltest_
name: Café
-
Test the unaccent-enabled 'ilike' on product.
-
!python {model: product.product}: |
ids = self.search(cr, uid, [('name'
assert ids == [ref('ymltest_
ids = self.search(cr, uid, [('name'
assert ids == [ref('ymltest_
ids = self.search(cr, uid, [('name','not ilike','Cafe')], {})
assert ref('ymltest_
ids = self.search(cr, uid, [('name','not ilike','café')], {})
assert ref('ymltest_
-
Unaccent. Create a product.
-
!record {model: product.product, id: ymltest_
name: Goat
-
Unaccent. Create a language.
-
!record {model: res.lang, id: ymltest_lang}:
name: French
code: fr_FR
-
Unaccent. Create a translation.
-
!record {model: ir.translation, id: ymltest_
name: 'product.
lang: fr_FR
src: 'Goat'
value: 'Chèvre'
type: 'model'
res_id: !eval ref('ymltest_
-
Test the unaccent-enabled 'ilike' with a translated product name.
-
!python {model: product.product}: |
ids = self.search(cr, uid, [('name'
assert ids == [ref('ymltest_