Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
4013 Zobrazení

I  need a custom search in product form based on some attribute name of products

Suppose My Product name is Apple black ABC 12345 .I know only some attributes from the products like black ABC .When I enter  black ABC  in the product search view it should shown related product wl shown based on my attribute name(black ABC,).How to create  a custom Search for this task

This is my code-----------

 <record id="product_template_search_custom_view" model="ir.ui.view">
            <field name="name">product.template.customsearch</field>
            <field name="model">product.template</field>
             <field name="inherit_id" ref="product.product_template_search_view"/>
             <field name="arch" type="xml">
             
             
              <xpath expr="/search/field[@name='name']" position="before">
                
               <field name="ean13" string="EAN 13 Baarcode" domain="[('sale_ok','=',1)]"/>
                  <field name="attribute_ield"/> #how to add that search
                 
             </xpath>
             
             
             
            </field>
        </record>

Avatar
Zrušit
Nejlepší odpověď

In Py class.. write a orm method called "name_search", in that you achieve the search however you want...

Refer for such methods in Standard objects, like res_partner etc..

Avatar
Zrušit
Autor

can you give one example..