Odoo Help


Add Custom Button To List View Header

Daniel Kauffman
on 8/31/15, 5:01 PM 4,451 views

In Odoo, when viewing a model in list view, buttons to "Create or Import" are usually displayed near the top of the page. Instead of these buttons, how would I display a custom button in this exact location on the page, when viewing my model in list view? I have a model that is read-only and would like to display a button to force synchronization of the model.

Axel Mendoza
On 8/31/15, 7:21 PM

This require to develop an extension in the template and javascript widget, like this:

You need to include a template that insert the button like:

<t t-extend="ListView.buttons">
<t t-jquery="button.oe_list_add" t-operation="after">
<button class="oe_button oe_new_button oe_highlight" type="button">New Button</button>

Next you need to extend the widget ListView like this:

    load_list: function(data) {
if (this.$buttons) {
this.$buttons.find('.oe_new_button').click(this.proxy('do_new_button')) ;
do_new_button: function () {
//implement your clic logic here  

This is an example of course

Like so? https://www.odoo.com/documentation/8.0/howtos/web.html

Daniel Kauffman
on 8/31/15, 8:50 PM

see an example in the updated response

Axel Mendoza
on 9/1/15, 6:16 PM

Will this code add the button for *all* tree views?

Limitless Virtual Enterprise, Andre de Kock
on 9/2/15, 6:47 AM

Yes. But you could restrict the visibility using options for the template

Axel Mendoza
on 9/2/15, 6:49 AM

Hello Daniel,

You can refer to account module & following files

  • /account/static/src/js/account_move_line_quickadd.js

  • /account/static/src/xml/account_move_line_quickadd.xml

This will not add the button at exact location where you wanted, but still can help you.

Hope this helps.

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

3 follower(s)


Asked: 8/31/15, 5:01 PM
Seen: 4451 times
Last updated: 7/29/17, 5:34 PM