Skip to Content
Menu
This question has been flagged
4 Replies
3219 Views

What happened ?

i have added a field in my product form , which display the number of the product . Everything works fine. Now what i want to do , is to be able to make a search by the new field ( number ) .

I went to settings - Fields and i saw that i have the option Not Searchable and i change it to searchable . But it still can't search , anyone know why?




Avatar
Discard

And what if my data isn't a computed one? i have added an integer field in the product form. 

Best Answer

Hello Nizar, 

i don't know if you solved the problem or you still looking for a solution..

this is done by creating a search view that looks like this : 

<record id="your Id " model="ir.ui.view">
    <field name="name"> search</field>
    <field name="model">Your model</field>
    <field name="arch" type="xml">
        <search string="searchbyname">
            <field name="number"/>        
            <group string="Filter">     // if you want to set filters...
             ...
       </search>
    </field>
</record>

Now all you have to do is to  fill the seach box with  a number and choose search in number.

let me know if it works 

Best regards. 


Avatar
Discard
Best Answer

If your field is a computed one (Function), it must be stored to allow searching on. In this case you must add store=True. 

Avatar
Discard
Author Best Answer

Thanks for the answer , My field is not computed. I have just added a field called number to my products. What i want to do , is to make a search on my products by number. Any help?

Avatar
Discard