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