Ir al contenido
Odoo Menú
  • Inicia 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
    • Inteligencia artificial
    • 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 propiedades
    • 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
  • Comunidad
    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
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

Modifying Purchase Order Report - Odoo Online

Suscribirse

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

Se marcó esta pregunta
inheritancereportspurchase_order
2 Respuestas
871 Vistas
Avatar
Lulu Pintado
I am trying to apply modifications to my purchase order report through inherited view. I am trying to moify the format of the shipping address (the information_block section in the screenshot below). 

This is the snippet of the architecture of the base view (I'm only including the part I am trying to modify):


<t t-name="purchase.report_purchaseorder_document">
    <t t-call="web.external_layout">
        <t t-set="o" t-value="o.with_context(lang=o.partner_id.lang)"/>
        <t t-set="address">
            <div t-field="o.partner_id" t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;, &quot;phone&quot;, &quot;vat&quot;], &quot;no_marker&quot;: True, &quot;phone_icons&quot;: True}"/>
        </t>
        <t t-if="o.dest_address_id">
            <t t-set="information_block">
                <strong class="d-block mt-3">Shipping address</strong>
                <div t-if="o.dest_address_id">
                    <div t-field="o.dest_address_id" t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;, &quot;phone&quot;], &quot;no_marker&quot;: True, &quot;phone_icons&quot;: True}" name="purchase_shipping_address"/>
                </div>

            </t>



View: report_purchaseorder_document


I have tried different syntax and the shipping address remains unchanged. How can I replace the information_block for this report? I believe the if statements its whats causing my issue - I do not think I am handling them properly. 


These are the sytanx I have used: 


Attempt 1:

<data>
  <data>
    <xpath expr="//t[@t-set='information_block']" position="replace">
      <t t-set="information_block">
        <strong>Shipping Address</strong><br/>
        <div t-field="o.dest_address_id" 
             t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone'], 'no_marker': True}"/>
      </t>
    </xpath>
  </data>

</data>

Attempt 2:


<data>
  <data>
    <xpath expr="//t[@t-if='o.dest_address_id']/t[@t-set='information_block']" position="replace">
      <t t-set="information_block">
        <strong>Shipping Address</strong><br/>
        <div t-field="o.dest_address_id" 
             t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone'], 'no_marker': True}"/>
      </t>
    </xpath>
  </data>

</data>

I hope i am making sense. Please ask any clarifying questions. Thanks! 

0
Avatar
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

Hi,

The issue you are encountering is likely due to how the t-if condition wraps the information_block. When targeting only the t-set node, the condition can prevent the replacement from being applied as expected.

You can try the following approach, which replaces the entire t-if block:

<xpath expr="//t[@t-if='o.dest_address_id']" position="replace">
    <t t-if="o.dest_address_id">
        <t t-set="information_block">
            <strong>Shipping Address:</strong><br/>
            <div t-field="o.dest_address_id"
                 t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone'], 'no_marker': True}"/>
        </t>
    </t>
</xpath>

This ensures that the full conditional structure is overridden correctly.

Alternatively, if your goal is only to modify the shipping address format (without affecting the surrounding logic), you can directly target the specific block inside the template:

<xpath expr="//div[@name='purchase_shipping_address']" position="replace">
    <div t-field="o.dest_address_id"
         t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone'], 'no_marker': True}"/>
</xpath>

This second approach, avoids modifying the conditional logic and focuses only on the display format.


Hope it helps

0
Avatar
Descartar
Avatar
Zehntech Technologies Inc.
Mejor respuesta

Hello, 

You're on the right track this issue typically comes from how the t-set is wrapped inside a t-if, which makes the XPath a bit sensitive.

In this case, instead of targeting only t-set="information_block", you should target it within its parent condition, ensuring the full structure is correctly matched.

You can try a more precise XPath like this:

<xpath expr="//t[@t-if='o.dest_address_id']//t[@t-set='information_block']" position="replace">

<t t-set="information_block">

<strong>Shipping Address</strong><br/>

<div t-field="o.dest_address_id"

t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone'], 'no_marker': True}"/>

</t>

</xpath>

Also, make sure that:

  • Your inherited view is correctly linked to report_purchaseorder_document
  • The module is upgraded and cache is cleared (especially on Odoo Online, changes may take a moment)

If it still doesn’t apply, another reliable approach is to replace the parent t-if block entirely and redefine your structure.

Hope this works for you! If you need any help implementing this or want a more optimized approach, feel free to reach out for further discussion

Regards,

Zehntech Technologies Inc.

santosh.sekwadia@zehntech.com

-1
Avatar
Descartar
¿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
RfQ/PO don't use supplier or manufacturer product name/nr
reports purchase_order
Avatar
1
abr 26
4052
Loading for forever on clicking on save button.
inheritance purchase_order loading
Avatar
Avatar
1
jul 23
3751
Purchase order READONLY_STATES inherit
inheritance purchase_order odoo9
Avatar
Avatar
1
jul 23
6344
Modify report template request for quotation and order
templates reports purchase_order
Avatar
0
dic 23
6158
'order' object has no attribute '_line_no' while making custom reports
rml reports purchase_order
Avatar
0
mar 15
4264
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 Svenska ภาษาไทย 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.

Sitio web hecho con

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