Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

3

How can create a new button in the header of the tree view after the "create button or 'import' "?

By
NIKHIL KRISHNAN
on 7/20/16, 6:08 AM 600 views

I don't know hoe to add a extra button of the header of the tree view?

<record model="ir.ui.view" id="crm_todo_tree_view_opportunity">
 <field name="name">Todo Opportunities Tree</field>
 <field name="model">crm.lead</field>
 <field name="arch" type="xml">
<tree string="Opportunities" fonts="bold:message_unread==True" colors="gray:probability == 100;red:date_deadline and (date_deadline &lt; current_date)">
 <field name="date_deadline" invisible="1"/>
 <field name="create_date" invisible="1"/>
 <field name="name" string="Opportunity"/>
 <field name="partner_id" string="Customer"/>
..................................................
..................................................
................................................
</tree>
</field>
</record> in this view there is button CREATE, after that i need a new button. Please help me thanks in advance.
2
Tuan
On 7/20/16, 10:38 AM

you can try with the code above:


<t t-extend="ListView.buttons">

<t t-jquery="button.oe_list_add" t-operation="after">

<t t-if="widget.model=='your.model'">

<button class="oe_button oe_list_add_planing_daily oe_highlight"

type="button">Create Planing Daily</button>

<button class="oe_button oe_list_view_current_session oe_highlight"

type="button">Current Session</button>

</t>

</t>

</t>


here I only add 2 buttons on tree list for "your.model"


hope it helps

I created a template, located it in static/src/xml/ folder, and assigned the template to the 'res.partern' model,

Now, how to link these two buttons with specific methods in the model??

Tarek Mohamed Ibrahim
on 7/21/16, 9:33 AM

The code only work for the tree view (not for the tree on one2many field). If you do follow by the code, you will see 2 buttons appear next to "Create" or "Import" buttons for "your.model"

Tuan
on 7/21/16, 10:21 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/20/16, 6:08 AM
Seen: 600 times
Last updated: 11/1/16, 1:16 AM