summaryrefslogtreecommitdiff
path: root/addons/product/tests/test_variants.py
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2018-04-25 21:50:19 +0200
committerNicolas Martinelli <nim-odoo@users.noreply.github.com>2018-04-26 15:07:01 +0200
commitd88c3706dfbe4f77bfcb2bfcc6bd95e7758cd49f (patch)
tree4febbe919670f6575432e7e3821f730ddd0201f3 /addons/product/tests/test_variants.py
parentb4f1e316e64e628928edeaef834bd1aec91d60b6 (diff)
[FIX] product: name search `not ilike`
- Create a product named 'toto' - Perform a call to `name_search`: `self.env['product.product'].name_search('pouet', [], 'not ilike')` Product 'toto' doesn't show up in the result list. The domain should take into account that `default_code` can be `False`. Note: the bug also occurs if the product is called 'trululu'. opw-1837957
Diffstat (limited to 'addons/product/tests/test_variants.py')
-rw-r--r--addons/product/tests/test_variants.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/product/tests/test_variants.py b/addons/product/tests/test_variants.py
index 7917a0d4a2b..804bbc55c95 100644
--- a/addons/product/tests/test_variants.py
+++ b/addons/product/tests/test_variants.py
@@ -40,6 +40,15 @@ class TestVariantsSearch(TransactionCase):
self.assertIn(self.product_shirt_template, search_value,
'Shirt should be found searching L')
+ def test_name_search(self):
+ self.product_slip_template = self.env['product.template'].create({
+ 'name': 'Slip',
+ })
+ res = self.env['product.product'].name_search('Shirt', [], 'not ilike', None)
+ res_ids = [r[0] for r in res]
+ self.assertIn(self.product_slip_template.product_variant_ids.id, res_ids,
+ 'Slip should be found searching \'not ilike\'')
+
class TestVariants(common.TestProductCommon):