Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Add Custom Button To List View Header

Naroči se

Get notified when there's activity on this post

This question has been flagged
listviewbuttonodoo-update
6 Odgovori
51860 Prikazi
Avatar
Daniel Kauffman

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.

3
Avatar
Opusti
Niyas Raphy (Walnut Software Solutions)

In latest odoo versions, it can be achieved easily as we do in form view, see: https://www.youtube.com/watch?v=R8eG6uOxHKw

Avatar
Axel Mendoza
Best Answer

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>
</t>
</t>

Next you need to extend the widget ListView like this:

instance.web.ListView.include({
    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

7
Avatar
Opusti
Daniel Kauffman
Avtor

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

Axel Mendoza

see an example in the updated response

Andre de Kock

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

Axel Mendoza

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

Ưng Tú

thanks for your solution but when i click on button, show error: "Traceback:

Error: Couldn't find method 'do_new_button' in widget". Can u show me when my error

Thank you agian and have a nice day

Herve

@Ưng Tú : same for me, and I'm messing around this issue ...

Avatar
Taha ZIADEH
Best Answer

In Odoo 11, here is how to achieve this:
Let's say we want to add special filtering functionality through a button
First create a template that is responsible of displaying the button :

<?xml version="1.0" encoding="UTF-8"?>

<template xml:space="preserve">

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

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

<button t-if="widget.modelName == 'your.model.name'" type="button" class="btn btn-primary btn-sm oe_filter_button" accesskey="f">

Advanced Filters

</button> 

</t>

</t>

</template>

P.S.:Don't forget to add the file containing the above template to the manifest
So far the button will be available but not functional. In order to make it functional, you have to add javascript support for its click event :

odoo.define('whatever.filter_button', function (require) {

"use strict";

var core = require('web.core');

var ListController = require('web.ListController');

ListController.include({

renderButtons: function($node) {

this._super.apply(this, arguments);

if (this.$buttons) {

let filter_button = this.$buttons.find('.oe_filter_button');

filter_button && filter_button.click(this.proxy('filter_button')) ;

}

},

filter_button: function () {

console.log('yay filter')

//implement your click logic here

}

});

})

Then, load the javascript file you wrote as a script like:

<template id="assets_backend" name="whatever_name assets" inherit_id="web.assets_backend">

<xpath expr="." position="inside">

<script src="/your_module_name/static/src/js/filter_button.js" type="text/javascript"/>

</xpath>

</template>

For further implementation details, don't hesitate to post your comments or questions :)

3
Avatar
Opusti
gain charlie

Hi , How to do this in Odoo 12?

Avatar
Adil Akbar
Best Answer

Hi, you can follow this: 


hope it helps

0
Avatar
Opusti
Avatar
Jerry zhang
Best Answer

How do I add this button to Kanban View Header? Thanks

0
Avatar
Opusti
Avatar
Adrian Nicorici
Best Answer

@Taha ZIADEH

In my case it did not work until i added at the end:

core.action_registry.add('product.template.custom_filter', ListController);
// return the object.
return ListController;

JS file looks like this:

odoo.define('product.template.custom_filter', function (require) {

"use strict";
console.log('something');
var core = require('web.core');
console.log('require list controller');
var ListController = require('web.ListController');
console.log('list controler: ' + ListController);
ListController.include({

renderButtons: function($node) {

this._super.apply(this, arguments);

if (this.$buttons) {

let filter_button = this.$buttons.find('.oe_filter_button');

filter_button && filter_button.click(this.proxy('filter_button')) ;

}

},

filter_button: function () {
console.log('yay filter');
}

});
console.log('registering');
core.action_registry.add('product.template.custom_filter', ListController);
// return the object.
return ListController;
})



0
Avatar
Opusti
Avatar
Emipro Technologies Pvt. Ltd.
Best Answer

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.

0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Inline Edit button near create
xml listview button js
Avatar
0
jul. 21
3003
How easy is it to add a button to mark Tasks as complete (in the List View)? v13 Solved
listview task button customization
Avatar
Avatar
1
jun. 20
6200
How to Implement Column-wise Filters in CRM List View (Odoo 18)
listview
Avatar
Avatar
1
avg. 25
1489
Opening new window with button in OpenERP Solved
button
Avatar
Avatar
1
jan. 24
15157
How to Add custom button on each row of list view that can redirect to another list view?
listview report button technical odoo
Avatar
Avatar
1
nov. 22
5158
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now