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

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?

Ảnh đại diện
Huỷ bỏ

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/

Câu trả lời hay nhất

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.

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

Thank you!!!!!

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 11 23
3251
7
thg 4 21
20693
1
thg 10 20
5005
1
thg 5 18
8706
2
thg 11 16
4331