Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

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

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
javascriptxmlemployeebuttonmanifest
3 Respuestas
8568 Vistas
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
Descartar
Avatar
Rama Altayeb
Mejor respuesta

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
Descartar
Rama Altayeb

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

Avatar
Mehjabin Farsana
Mejor respuesta

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
Descartar
Marco Duran
Autor

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
Mejor respuesta

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
Descartar
Marco Duran
Autor

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

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Crash while using useService : TypeError: right-hand side of 'in' should be an object, got undefined
javascript manifest
Avatar
1
may 24
3476
Get data from JS file to XML file Resuelto
javascript xml
Avatar
Avatar
1
ago 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? Resuelto
xml button
Avatar
Avatar
Avatar
2
jul 19
9886
How do create a button using xml and its action in the JavaScript in Odoo 10 ?
javascript button
Avatar
Avatar
1
jul 17
3918
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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