This question has been flagged
1 Reply
6574 Views

Hello Guys !!

Can anyone help to know how to create the action of a menu that opens form view not tree and in the read mode which means of the first record.

I have tried this :

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

                <field name="name">Test</field>

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

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

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

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

                <field name="help" type="html">

                        <p class="o_view_nocontent_smiling_face">

                        Create a Test!

                        </p>

            </field>

        </record>

This code let me open in the form view but to create a new record.

I want it to open an existing record (the first one as an example)

Thanks a lot in advance.

Best regards.

Avatar
Discard
Author Best Answer

I have found the solution to my problem.

In the documentaion of ODOO:

res_id (optional)
if the default view is form, specifies the record to load (otherwise a new record should be created)

So the solution is to add the res_id of a specific record so that the create mode is visible.

Thanks a lot.

Best regards.

Avatar
Discard