Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

Odoo 16 - How to add a button next to Create/Export in List View and Kanban View

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
javascriptxmlemployeebuttonmanifest
3 Risposte
8571 Visualizzazioni
Avatar
Marco Duran

In Odoo 12, 14 and 15 I have created a button next to Create/Export in List View and Kanban View, it renders and perform an action without any problem. But in Odoo 16 I am having an issue that the button is not rendering in both views.

Example List View Odoo 15:


My code is looks like this in Odoo 15:

Manifest:

"assets": {

    "web.assets_backend": [

        "/proyect_name/static/src/js/hr_list_view.js"

    ],

    'web.assets_qweb': [

        '/proyect_name/static/src/xml/hr_list_view.xml'

    ]

}


XML:

<templatesxml:space="preserve">    

    <tt-extend="ListView.buttons">

        <tt-jquery="button.o_list_export_xlsx"t-operation="after">

            <tt-if="widget.is_action_enabled('export_xlsx') and widget.isExportEnable">                                  <buttonid="list_view_test" t-if="widget.modelName == 'hr.employee'"type="button"class="btn btn-secondary oe_export_test o_list_export_xlsx open_wizard_action_kanban oe_highlight">Testbutton>

            t>

        t>

    t>

templates>


Javascript:

odoo.define('export_ins.print_ins', function (require) {

    "use strict";

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

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

    ListController.include({

        renderButtons: function ($node) {

            this._super.apply(this, arguments);

            if (this.modelName === "hr.employee" && this.$buttons) {

                this.$buttons.find('.oe_export_test').click(this.proxy('action_def'));  

            }

        },

        action_def: function (ev) {

            varself = this;

            returnrpc.query({model:'hr.employee', method:'odoo_button_click_test'

            },{

                shadow:true

            }).then(function (res) {

                returnself.do_action(res)

            }).catch(function (error) {

                console.log(this, error.message.data.message);

            });

        },

    });

});


How can I perform the same rendering and action but in Odoo 16?


Thanks for the response!

1
Avatar
Abbandona
Avatar
Rama Altayeb
Risposta migliore

For odoo16 Follow this tutorial 

www.cybrosys.com/blog/how-to-add-a-create-button-near-tree-kanban-view-in-odoo-15

But put your xml and js files in assets_backend bundle
and then change o_list_button_button to o_list_button_add


 

<t t-extend="ListView.buttons" t-name="some_unique_name">
        <t t-jquery="button.o_list_button_add" t-operation="after">
            <button type="button" class="btn btn-primary open_wizard_action">
                    Open Wizard
            </button>
        </t>
    </t>


       
           
       
   

1
Avatar
Abbandona
Rama Altayeb

https://www.cybrosys.com/blog/how-to-add-a-create-button-near-tree-kanban-view-in-odoo-15

Avatar
Mehjabin Farsana
Risposta migliore

Hi,
In Odoo 16 the qweb templates are loaded in the assets_backend. We don't have web.assets_qweb in 16.
Try by removing the assets_qweb and add the path in the assets_backend.


"assets": {
"web.assets_backend": [
"/proyect_name/static/src/js/hr_list_view.js",
'/proyect_name/static/src/xml/hr_list_view.xml'
],
}


Hope this will help you

Thank you

1
Avatar
Abbandona
Marco Duran
Autore

Hello,
Thanks for the fast response.

I changed the paths to web.assets_backend but still without success, and in the browse console I am getting this message: "Views: using legacy view: qweb" and "Views: using legacy view: activity" (I don't know if it's because of my code) although I removed web.assets_qweb and changed to web.assets_backend. And at this point I don't what could be the problem.

Regards!

Avatar
Ashish Hirpara
Risposta migliore

Here is the complete code for creating a button in Odoo 16 List View and Kanban View:

Manifest:

"assets": {

"web.assets_backend": [

    "/proyect_name/static/src/js/hr_list_view.js"

],

'web.assets_qweb': [

    '/proyect_name/static/src/xml/hr_list_view.xml'

]

}

XML:

"ListView.buttons">

    "button.o_list_export_xlsx" t-operation="after">

        if="widget.is_action_enabled('export_xlsx') and widget.isExportEnable">                                  

templates>

Javascript:

odoo.define('export_ins.print_ins', function (require) {

use strict"; var ListController = require('web.ListController'); var rpc = require('web.rpc'); ListController.include({ renderButtons: function ($node) { this._super.apply(this, arguments); if (this.modelName === "hr.employee" && this.$buttons) { this.$buttons.find('.oe_export_test').click(this.proxy('action_def')); } }, action_def: function (ev) { var self = this; return rpc.query({model:'hr.employee', method:'odoo_button_click_test' },{ shadow:true }).then(function (res) { return self.do_action(res) }).catch(function (error) {...........

0
Avatar
Abbandona
Marco Duran
Autore

Hi Ashish. I don't know if you mistakely copy the wrong code? It is because the code is like I shared for the question, or is there any difference?

Thanks for the response and help!

Regards

Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
Crash while using useService : TypeError: right-hand side of 'in' should be an object, got undefined
javascript manifest
Avatar
1
mag 24
3476
Get data from JS file to XML file Risolto
javascript xml
Avatar
Avatar
1
ago 20
9899
Comparing javascript varriable with t-if
javascript xml
Avatar
Avatar
Avatar
2
giu 20
5016
how shall I put a button in the center of its line? Risolto
xml button
Avatar
Avatar
Avatar
2
lug 19
9887
How do create a button using xml and its action in the JavaScript in Odoo 10 ?
javascript button
Avatar
Avatar
1
lug 17
3918
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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