Odoo Help

0

Product template search view wrong behavior

By
Diego Calzadilla
on 3/26/15, 12:57 PM 1,120 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.


Thanks!!

0
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?

MEXYTUL, 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
0

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?

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

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 3/26/15, 12:57 PM
Seen: 1120 times
Last updated: 3/28/17, 4:15 AM