Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3984 Lượt xem

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>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

can you give one example..