unnamed-dev
unnamed-dev

Reputation: 187

odoo14 button does not get added to the oe button box

I have added

<div class="oe_button_box" name="button_box">
    <field name="active" invisible="1"/>
    <button type="object" class="oe_stat_button" icon="fa-archive" name="toggle_active" string="Archive" attrs="{'invisible': [('active', '=', False)]}"/>
    <button type="object" class="oe_stat_button" icon="fa-archive" name="toggle_active" string="Restore" attrs="{'invisible': [('active', '=', True)]}"/>
</div>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>

this to the sheet of the form of my view but unfortunately, the buttons do not get displayed.

This is what I want:

image with archive action

But this is what it looks like:

image without archive action

what is missing?

Upvotes: 1

Views: 507

Answers (1)

CZoellner
CZoellner

Reputation: 14768

That is not the button box but the action menu. IIRC you can't add anything there by extending a view, but by creating actions.

And if you want to add the archive functionality in Odoo 14+ you just have to add the field active invisible in your form view. That should be enough and is an exception to my statement before ;-)

If you need the ribbon, you have to add that, too, like in your example.

Edit: seems you should not put the field active into a div or probably the button_box div.

Upvotes: 1

Related Questions