Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Product template search view wrong behavior

Diego Calzadilla
on 3/26/15, 12:57 PM 650 views

In product template search view is defined a field to do search by product attributes:

<field string="Product Variant" name="product_variant_ids" filter_domain="['|', ('product_variant_ids.name','ilike',self), ('product_variant_ids.attribute_value_ids.name','ilike',self)]"/>

product_variants_ids is a one2many field in product.template. When I write some attribute value, it brings the correct record, but when I write the atrribute name, it brings nothing, for example, in attribute page for some product I have:

MEMORY   32gb

COLOR      red

If I type 32gb, it brings record, whereas if I type MEMORY, brings nothing

Can any one help me? I would also like to understand filter_domain of this example.


Diego Calzadilla
On 3/27/15, 1:50 AM

     <field string="Product Variant" name="product_variant_ids" filter_domain="['|', ('product_variant_ids.name','ilike',self), ('product_variant_ids.attribute_value_ids.name','ilike',self), ('product_variant_ids.attribute_value_ids.attribute_id.name','ilike',self)]"/>

I tried this in order to keep both types of search, but didn't work, any suggestions?

Diego Calzadilla
on 3/27/15, 1:51 AM

You need to add an or ("|") before... |, |, cond1, cond2, cond3

Jérémy Kersten (jke)
on 3/27/15, 3:08 AM

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--
| 3 2 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 3/26/15, 6:26 PM

Hello, It's a bug...

The right domain should be : 

<field string="Product Variant" name="product_variant_ids" filter_domain="['|', ('product_variant_ids.name','ilike',self), ('product_variant_ids.attribute_value_ids.attribute_id.name','ilike',self)]"/>

You can change this one in view directly !

Fix merged in V8 : https://github.com/odoo/odoo/commit/42aa9096d9c1aa54529960e70590335660e33d12 

Thank you, it works!! However, search by attribute value is lost, I would like to keep both types of search. I tried something like this: And didn't work, any suggestions?

Diego Calzadilla
on 3/27/15, 1:49 AM
Diego Calzadilla
on 3/27/15, 1:49 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 3/26/15, 12:57 PM
Seen: 650 times
Last updated: 3/27/15, 1:50 AM