How to call a FORM VIEW via a button? (Odoo 13 enterprise)

Asked by Leon Nguyen

Hello,

I'm trying to call a FORM VIEW via a button, which defined like this :

<button type="action" string="submit" name= "198" class="oe_highlight"/>

But it just calls the LIST VIEW of it via id=198 .

So how to call a FORM VIEW via a button?

Please help!

Thank you!

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Web Client Edit question
Assignee:
No assignee Edit question
Solved by:
Farid Ghanchi
Solved:
Last query:
Last reply:
Revision history for this message
Best Farid Ghanchi (gfarid) said :
#1

Create new action for that model/object for form related and add that action id on button like.

action:
<record model="ir.actions.act_window" id="action_model_name_form">
        <field name="name">Your form name</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">your.model</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="view_id" ref="model_form_id"/>
    </record>
Button:
<button type="action" string="submit" name= "action_for_form" class="oe_highlight"/>

Revision history for this message
Farid Ghanchi (gfarid) said :
#2

<button type="action" string="submit" name= "action_model_name_form" class="oe_highlight"/>

Revision history for this message
Leon Nguyen (leonq8) said :
#3

Thank you for your support. Can I use these by using Server Actions with choose: Execute Python Code?

Revision history for this message
Leon Nguyen (leonq8) said :
#4

Thanks Farid Ghanchi, that solved my question.