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
    • eLearning
    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
    • Información
    • 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
    Food & Hospitality
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Guest House
    • Distribuidor de bebidas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consulting
    • Accounting Firm
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Trades
    • Handyman
    • Hardware y asistencia informática
    • Solar Energy Systems
    • Zapatero
    • Servicios de limpieza
    • HVAC Services
    Others
    • Nonprofit Organization
    • 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

Inherit Qweb

Suscribirse

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

Se marcó esta pregunta
v8qwebinheritreport
4 Respuestas
49681 Vistas
Avatar
Alex

In the new report module we have the company external header in /views/layouts.xml. Its ID is report.external_layout_header. If I edit the view directly in Odoo, it changes but now I want to inherit it in a module and I am not able to do that. I am not a coder so maybe it's a dummy problem.

This is the original view:

<t t-name="report.external_layout_header">
    <div class="header">
        <div class="row">
            <div class="col-xs-3">
                <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-height: 45px;"/>
            </div>
            <div class="col-xs-9 text-right" style="margin-top:20px;" t-field="company.rml_header1"/>
        </div>
        <div class="row zero_min_height">
            <div class="col-xs-12">
                <div style="border-bottom: 1px solid black;"/>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-3">
                <div t-field="company.partner_id" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: true}" style="border-bottom: 1px solid black;"/>
            </div>
        </div>
    </div>
</t>

 

So I create my module with empty __init__.py and I call the qweb view in __openerp__.py like this:

'qweb': ['views/my_layouts.xml',],

In my_layouts.xml I extend the view like this:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

<templates>

<t t-extend="report.external_layout_header">
            <t t-jquery="div.header" t-operation="replace">

            <<MY CODE>>

            </t>
</t>

</templates>

    </data>
</openerp>

But not works. I can install my module without error but the header doesn't change. I don't know where is the error so any help is appreciated. Thank you.

0
Avatar
Descartar
Avatar
Artur Bertram
Mejor respuesta

Try it with the following code in your "views/my_layouts.xml".

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="report_header_custom" inherit_id="report.external_layout_header">
            <xpath expr="//div[@class='header']" position="replace">
                <div class ="header">
                    Your Code
                </div>
            </xpath>
        </template>
    </data>
</openerp>

Add the report in youre "__openerp__.py" file in the data.

'data': ['views/my_layouts.xml',],

And dont forget the depends.

'depends': ['base_setup',  'report', ],

7
Avatar
Descartar
Avatar
Peter Nietz
Mejor respuesta

Hi, do you use <templates>  ...   </templates>  in your qweb xml? It is needed.

Another thing could be a dependency. In the __openerp__.py give the dependencies to the report module like:

'depends':['whaterver_report',],

andalso in your __init__.py import ur custom_module.py if one is used.

Then try this in your xml template file:

<templates>

<t t-extend="report.external_layout_header">
            <t t-jquery=".header" t-operation="replace">

                  <div class="header">
                      <div id="change_test"/>

                           <<< your code >>>

                  </div>

            </t>
</t>

</templates>

0
Avatar
Descartar
Alex
Autor

Yes, I use tag. I edit my post sorry. Don't I need to use them?

Alex
Autor

hahaha same error. I use

Peter Nietz

The tag must be used. Otherwise your code looks fine. I will try to reproduce your problem and have a look at it.

Alex
Autor

Thank you so much Peter. Furthermore I am just testing so I am not adding difficult code, just deleting for example the company tagline. So I can't understand where is the problem.

Peter Nietz

Inheritence of QWEB isn't very intuitiv ... I now experience the problem that the template from which I inherit produces errors even though I didn't change anything in it, but only my custom template ... why?!?!? So code of my custom modul is now used in standard modules... so where is the point of inheritance?

Peter Nietz

I edited my answer, try it and then take a look with fe. firebug if the id change_test is included. For me this worked. Hope it helps u...

Avatar
Andreas Tolstov
Mejor respuesta

I think you don't need <openerp> and <data> tags in qweb templates.

Only in view templates.

0
Avatar
Descartar
Alex
Autor

Maybe they are not necessary because if I delete them I have no install error, but don't solve the main problem. Here there is someone with the same problem. https://www.odoo.com/forum/Help-1/question/Edit-the-qweb-template-with-a-custom-modul-54304

¿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
Create QWeb reports from Odoo application
v8 qweb report
Avatar
0
dic 15
5098
Set report orientation Resuelto
v8 qweb report
Avatar
Avatar
1
mar 15
15043
Edit the qweb template with a custom modul. Resuelto
v8 qweb report
Avatar
Avatar
Avatar
3
mar 15
18833
Transfer the sum of all order lines of one page to the next page.
v8 qweb report
Avatar
0
mar 15
3937
How do you use variables in a Qweb loop? Resuelto
v8 qweb report loop
Avatar
Avatar
Avatar
Avatar
Avatar
11
abr 23
94490
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