Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
169 Переглядів
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>
Аватар
Відмінити
Автор

```
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);
}
});
```

Найкраща відповідь

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

Аватар
Відмінити
Автор Найкраща відповідь
  1. ADD <rng:optional><rng:attribute name="no_open"/></rng:optional> in base/rng/list_view.rng file
  2. use <list no_open="1">
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
вер. 25
301
4
вер. 25
396
3
вер. 25
458
3
вер. 25
549
1
вер. 25
479