Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita 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
  • Proyectos
  • 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

Address block on invoices to the left (about QWeb inheritance and xpath position attributes)

Suscribirse

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

Se marcó esta pregunta
qweblayoutinvoicesxpathOdoo13.0
3 Respuestas
13829 Vistas
Avatar
Jürgen Bereuter

Hi, i like to change the layout of invoices in Odoo 13. The address field should be on the left side. I know, that i had to change some reports or views, but i dont know which one exactly, now it is trial and error (with more error than success). thanks!

0
Avatar
Descartar
Jürgen Bereuter
Autor

Because my karma is too low i write this comment to myself - now its easier to look into the right fields, not just playing around with more created errors.. thank you all and merci vielmol, jürgen

Ermin Trevisan

My pleasure, but an upvote is very welcome :-)

Jürgen Bereuter
Autor

sorry - not enough karma points for upvoting. But all answers helped a lot!

Avatar
Ermin Trevisan
Mejor respuesta

In order to manipulate the position of such content elements, you need to understand Bootstrap's grid system and use the corresponding classes. You should create a module and inherit the corresponding QWeb view using xpath expressions to amend the corresponding classes.

The following example is for Odoo 9.0 and does not exactly what you want, but it shows a good part of manipulating QWeb views according to your custom requirements, you'll get the idea:

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

<template id="tw_twanda_reportdesign.report_invoice_document" name="tw_twanda_design_invoice" inherit_id="account.report_invoice_document" active="True" priority="17">

<xpath expr="//div[@class='page']" position="attributes">
<attribute name="style">font-family: 'Ubuntu', sans-serif;</attribute>
</xpath>

<xpath expr="//div[@class='col-xs-5 col-xs-offset-7']" position="attributes">
<attribute name="style">margin-top: 10mm; margin-bottom: 25mm</attribute>
</xpath>

<xpath expr="//h2" position="attributes">
<attribute name="style">font-size: 24px; color: #e4677f; margin-top: 10mm; margin-bottom: 25mm</attribute>
<attribute name="class">text-epsilon</attribute>
</xpath>

<xpath expr="//div[@t-if='o.date_invoice']" position="attributes">
<attribute name="class">col-xs-3</attribute>
</xpath>

<xpath expr="//span[@t-field='l.quantity']" position="replace">
<t>
<t t-set="mod_qty">
formatLang(l.quantity, digit=0)
</t>
<t t-if="mod_qty == l.quantity">
<span><t t-esc="mod_qty"/></span>
</t>
<t t-if="mod_qty != l.quantity">
<span><t t-esc="('%.0f'% l.quantity * 1)"/></span>
</t>
</t>

</xpath>

</template>

</data>
</odoo>

Recommended reading:

- Yenthe's famous tutorial: https://www.odoo.yenthevg.com/inheriting-and-modifying-qweb-reports/

- Bootstrap grid system: https://getbootstrap.com/docs/4.0/layout/grid/

- Really really helpful for testing your xpath-expressions: https://codebeautify.org/Xpath-Tester

- View Inheritance and xpath locators (position attribute): http://learnopenerp.blogspot.com/2018/01/inheritance-in-models-and-views.html (please be aware that since Odoo 12 there is a new position attribute available: "move", see https://github.com/odoo/odoo/pull/23877)


2
Avatar
Descartar
Sehrish

nice sharing

Ermin Trevisan

Also your upvote is welcome.

Avatar
Paresh Wagh
Mejor respuesta

Hi Jurgen:

To make changes to the location of the address field, you will need to customize one of the web.external_layout_xxxx views depending on which document layout you are using at your site. Note that this change will reflect in all the documents that use this layout. If you need to make the change for just one document, you will need to define a custom layout and use that instead for your document.

0
Avatar
Descartar
Avatar
Jürgen Bereuter
Autor Mejor respuesta

Hello Paresh, thank you for the hint. I am going to change the whole layout (the envelopes have the windows for the address on the left side).
I found a short-link to edit the layout (as you mentioned): in developer mode, go to settings, there is a edit-link to the layout. There are to possible lines to achieve my goal - i am grateful for an idea, how and where i need to change the code (add a row or column, new class or whatever..):

external_layout_standard:

....
 <div class="article o_report_layout_standard" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id" t-att-data-oe-lang="o and o.env.context.get('lang')">

            <t t-call="web.address_layout"/>

            <t t-raw="0"/>

        </div>
....​

or in address_layout

<t t-name="web.address_layout">
        <t t-set="colclass" t-value="('col-md-5' if report_type == 'html' else 'col-5') + ' ml-auto'"/>
        <t t-if="address">
            <div class="address row">
                <t t-if="information_block">
                    <t t-set="colclass" t-value="'col-5 offset-1'"/>
                    <div name="information_block" class="col-6">
                        <t t-raw="information_block"/>
                    </div>
                </t>
                <div name="address" t-att-class="colclass">
                    <t t-raw="address"/>
                </div>
            </div>
        </t>
    </t>

0
Avatar
Descartar
Paresh Wagh

You may need to make changes within the <t t-if="address">....</t> block to get what you need.

Just to throw some light on this issue since it is a bit complex....The "address" variable is composed and set in the account.report_invoice_document view and used in web.address_layout. If you are not able to achieve the result you desire, you may need to look at the way web.external_layout_standard, web.address_layout and account.report_invoice_document work together to decide where the changes need to be made.

Ermin has provided a good set of links that describe how the Bootstrap grid system works. As mentioned by him, one needs to understand this to ensure that the reports are designed to work as expected.

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

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

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
multiple invoice layout Resuelto
layout invoices
Avatar
Avatar
Avatar
Avatar
Avatar
43
abr 23
48789
How to sum lines in a QWEB report (Odoo 13)? Resuelto
qweb Odoo13.0
Avatar
Avatar
1
mar 22
5413
Hidding <p> tag from account.invoice Resuelto
xpath Odoo13.0
Avatar
Avatar
1
oct 20
3320
odoo xpath add existing element inside element Resuelto
qweb xpath website
Avatar
Avatar
Avatar
Avatar
3
ene 25
15894
Xpath problems...Help me write this xpath
views qweb xpath
Avatar
Avatar
1
ago 24
3256
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • 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 estar 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