This is my code. I only want to display the list — clicking a row should NOT open the form view. This has been really challenging; I’ve spent two days on it. I’m stuck and would really appreciate some help!
<data>
<record id="mo_plan_view_list" model="ir.ui.view">
<field name="name">mo.production.list</field>
<field name="model">mrp.production</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<list editable="bottom" create="0" edit="0" import="0" open_form_view="0" >
<field name="company_id" column_invisible="True"/>
<field name="name" decoration-bf="1"/>
<field name="product_id" readonly="1" optional="show"/>
</list>
</field>
</record>
<record id="mo_plan_action" model="ir.actions.act_window">
<field name="name">plan</field>
<field name="res_model">mrp.production</field>
<field name="path">production</field>
<field name="view_mode">list</field>
<field name="views">
[(ref('mo_plan_view_list'), 'list')]
</field>
</record>
</data>
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi,
Please try the code below,
<data>
<record id="mo_plan_view_list" model="ir.ui.view">
<field name="name">mo.production.list</field>
<field name="model">mrp.production</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<list editable="bottom" create="0" edit="0" import="0">
<field name="company_id" column_invisible="True"/>
<field name="name" decoration-bf="1"/>
<field name="product_id" readonly="1" optional="show"/>
</list>
</field>
</record>
<record id="mo_plan_action" model="ir.actions.act_window">
<field name="name">plan</field>
<field name="res_model">mrp.production</field>
<field name="view_mode">list</field>
<field name="view_id" ref="mo_plan_view_list"/>
<field name="target">current</field>
<!-- This is the key attribute to prevent opening form view on click -->
<field name="flags">{'action_buttons': true, 'headless': true}</field>
</record>
</data>
Hope this helps
- ADD <rng:optional><rng:attribute name="no_open"/></rng:optional> in base/rng/list_view.rng file
- use <list no_open="1">
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 9 25
|
296 | ||
|
4
thg 9 25
|
391 | ||
|
3
thg 9 25
|
455 | ||
|
3
thg 9 25
|
533 | ||
|
1
thg 9 25
|
465 |
```
patch(ListRenderer.prototype, {
async onCellClicked(record, column, ev) {
console.log("ListRenderer.onCellClicked", record, column, ev);
if (this.props.list.context && this.props.list.context.no_open_form) {
ev.preventDefault();
ev.stopPropagation();
return;
}
return super.onCellClicked(record, column, ev);
}
});
```