Raihan
Raihan

Reputation: 145

How to add a new button inside the action menu Odoo 12?

Im trying to add a button inside the action in the model named 'consultation', After clicking the button i need to open up the wizard i created follow,But im stuck in some errors



<?xml version="1.0" encoding="utf-8"?>
<odoo>
     <record id="specialist_no_show" model="ir.ui.view">
         <field name="name">specialist no show</field>
         <field name="model">specialist.no.show</field>
         <field name="arch" type="xml">
            <form string="No Show">
                <group>
                    <group>
                        <field name="partner_id"  readonly="1"/>
                    </group>
                </group>
                <footer>
                    <button name="update_no_show" string="Confirm" type="object" class="btn-primary"/>
                    <button string="Cancel" class="btn-secondary" special="cancel"/>
                </footer>
            </form>
         </field>
     </record>
    <act_window name="No Show"
            id="specialist_no_show"
            res_model="specialist_no_show" #model created for the wizard
            binding_model="consultation"   #model where i want to show the button in the action
            binding_views="form" 
            view_mode="list"
            target="new"
        />
</odoo>

Upvotes: 0

Views: 899

Answers (1)

adekock11
adekock11

Reputation: 614

I can spot some problems that you can try:

  • The XML ID for the form and the act_window must be different. In your example it is both specialist_no_show
  • The res_model must be specialist.no.show
  • The structure for the act_window is different depending on your Odoo Version (see below).

For Odoo Version 12.0

<act_window name="No Show"
        id="action_specialist_no_show"
        res_model="specialist.no.show"
        src_model="consultation"
        view_mode="form"
        target="new"
    />

For Odoo Version 13.0

<act_window name="No Show"
        id="action_specialist_no_show"
        res_model="specialist.no.show"
        binding_model="consultation"
        view_mode="form"
        target="new"
    />

Also, the error logs would be helpful as @Kenly suggested. Always post those.

Upvotes: 1

Related Questions