Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
7 Antworten
5750 Ansichten

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!!

Avatar
Verwerfen
Autor Beste Antwort


     <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)]"/>

Avatar
Verwerfen
Autor

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

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

Beste Antwort

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 

Avatar
Verwerfen
Autor

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?

Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Juli 19
5094
1
Jan. 25
1880
1
Okt. 23
2235
2
Sept. 22
9624
2
Apr. 22
4674