Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

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

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
javascriptxmlemployeebuttonmanifest
3 Besvarelser
8569 Visninger
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
Kassér
Avatar
Rama Altayeb
Bedste svar

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
Kassér
Rama Altayeb

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

Avatar
Mehjabin Farsana
Bedste svar

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
Kassér
Marco Duran
Forfatter

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
Bedste svar

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
Kassér
Marco Duran
Forfatter

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

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

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

Tilmeld dig
Related Posts Besvarelser Visninger Aktivitet
Crash while using useService : TypeError: right-hand side of 'in' should be an object, got undefined
javascript manifest
Avatar
1
maj 24
3476
Get data from JS file to XML file Løst
javascript xml
Avatar
Avatar
1
aug. 20
9899
Comparing javascript varriable with t-if
javascript xml
Avatar
Avatar
Avatar
2
jun. 20
5016
how shall I put a button in the center of its line? Løst
xml button
Avatar
Avatar
Avatar
2
jul. 19
9887
How do create a button using xml and its action in the JavaScript in Odoo 10 ?
javascript button
Avatar
Avatar
1
jul. 17
3918
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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