This question has been flagged
8 Replies
78348 Views

I add a new field using selection that consist list of country. How to filter the country in list view (using search field in top right of the screen)? Or how to add a search like "Search 'my_filter' for : " in the search bar like the image below? image description

Avatar
Discard
Best Answer

A good way to accomplish this is to modify that particular view, specifically the search view section. If it doesn't have one you can add it. Here is good instruction for this: link text

Also see this about the filter tag as another possible solution: link text

<filter string="Current" domain="[('state','in',('open','draft'))]" help="Draft, Open and Pending Tasks" icon="terp-project"/>
<field name="project_id" select="1" widget="selection">
    <filter domain="[('project_id.user_id','=',uid)]" help="My Projects" icon="terp-project"/>
</field>

The most simple method would be to create an advanced search including that custom field and save it.

Avatar
Discard
Author

Thanks for your answer, but can you help me to give a detailed step how to put that code or how to do it with developers mode in OpenERP? Because the documentation is not clear and I don't understand.

with OpenERP in Developer Mode browse to the place where you want to change the view. Find the drop-down on the upper left and select Edit Search View. An Edit SearchView dialog will open with form fields for editing the name, type etc. as well as the code for the view. For examples of how to code this open the file addons\stock\stock_view.xml and find the record tag with ID = view_picking_internal_search. Now go into the Warehouse/Incoming Shipments section of the app and click on search. The code for the search items you see is in that view file. Should help you understand how it works.

Author

thank you for your answer..It's working..GBU

Hi, You find a solution?

Best Answer
  1. Activate the Developer Mode

  2. Go to the view you want to add the filter to

  3. From the debug dropdown menu, select Manage Filters, and click Create

  4. Give the filter a name and select the correct model (in your case Project Issue?)

  5. Clear the User field so that everyone can access the filter

  6. In the Domain section you put the filter condition itself, for example [('region','=','Africa')]

  7. Save and go back to the tree view, and your filter should show up in the Custom Filters section of the search box

Hope that helps

Avatar
Discard
Author

Thanks for helping and giving answer. But it seems not working properly. I editing [('region','=','Africa')] into [('x_region','=','Africa')] (my field name) but it always get all of the issue. But if the code works, it still not a simple way to do with filter, isn't it? Because I have 7 selection of region, and if the user want to select 1 filter, he/she must have a 'anothor step to do' to pick the dropdown list in the search view. But again, thanks for your answer.

Best Answer

To search customers by phone or by mobile:

1. Activate the Developer Mode

2. Go to sales, customers

3. From the debug dropdown menu, select Edit SearchView

To search by phone add:

<field name="phone" filter_domain="['|','|',('display_name','ilike',self),('ref','=',self),('phone','ilike',self)]"/>

To search by mobile add:

<field name="mobile" filter_domain="['|','|',('display_name','ilike',self),('ref','=',self),('mobile','ilike',self)]"/>

Avatar
Discard