This question has been flagged
1 Reply
6577 Views

Hi community.

I've spent hours looking through example code from the trunk, but I can't figure out what I'm doing wrong.

I have a menu entry that should open my product list. I want this action to automatically filter the items (with adding a filter in the top right search box) by a custom field called "big". Here is my code:

<record id="product_product_big" model="ir.actions.act_window">

<field name="name">Products</field>

<field name="type">ir.actions.act_window</field>

<field name="res_model">product.product</field>

<field name="view_type">form</field>

<field name="view_mode">kanban,tree,form</field>

<field name="context">{"search_default_big":0}</field>

<field name="view_id" ref="product.product_product_tree_view"/>

<field name="search_view_id" ref="product.product_search_form_view"/>

</record>

    <menuitem id="ingresos_mend" action = "product_product_big" sequence="1" parent="menu_purchase_container" name="Ingreso de Notas de Pedido" />

I can click on the menu, and a list of products come up. But nothing is in the search box (no filter)! And the products are not filtered (all products are showing).

I've studied the source code. I want exact similiar funcionality as when you click Clients vs. Suppliers, the res.partner objects are already filtered (showing a filter in the top right search box) by Client or Supplier.

How can this be accomplished?

Avatar
Discard

you can see with click below of this link.it's ever been discussed. . http://help.openerp.com/question/17225/inherit-search-view-in-openerp7/

Best Answer

Ok, first of all you have to add filter name big on your search view, that's in product_search_form_view. Then you are going to be able to filter with that field by default.

Second, <field name="context">{"search_default_big":0}</field> must be <field name="context">{"search_default_big":1}</field>

Because 0 is false and 1 is true.

Avatar
Discard
Author

Thank you!!!!!