Skip to Content
Menu
This question has been flagged
1 Reply
3773 Views

Hi, I need to add a button to a row in tree view to change the state, how can I achieve it?

I'm adding the button directly like this:

<record id="view_xxx_tree" model="ir.ui.view">
<field name="name">xxx.tree</field>
<field name="model">xxx</field>
<field name="arch" type="xml">


<tree decoration-info="state=='draft'" name="appointment_tree">
<field name="sequence" widget="handle"/>
<field name="name" string="Name"/>
<field name="patient_id"/>
<field name="date"/>
<field name="responsible_id" invisible="1"/>
<field name="create_uid"/>

<field name="state"/>

<button name="draft" type="object" string="Draft" class="oe_highlight"/>


</tree>
</field>

</record>​


but it's not showing on the tree view

Avatar
Discard
Best Answer

you cant add button on tree view, but you can add it on one2many tree view in form view

Avatar
Discard

Well, technically you can but then you'll need to write custom JS code to handle button clicks in the tree view etc :) Your answer is correct though.

yes you can custom it by JS file, but the default odoo didn't allow yo to add button in the tree view