Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Artificial Intelligence
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Property Management
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Modifying Purchase Order Report - Odoo Online

Subscriure's

Get notified when there's activity on this post

This question has been flagged
inheritancereportspurchase_order
2 Respostes
858 Vistes
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
Best Answer

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.
Best Answer

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
Enjoying the discussion? Don't just read, join in!

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

Registrar-se
Related Posts Respostes Vistes Activitat
RfQ/PO don't use supplier or manufacturer product name/nr
reports purchase_order
Avatar
1
d’abr. 26
4052
Loading for forever on clicking on save button.
inheritance purchase_order loading
Avatar
Avatar
1
de jul. 23
3737
Purchase order READONLY_STATES inherit
inheritance purchase_order odoo9
Avatar
Avatar
1
de jul. 23
6341
Modify report template request for quotation and order
templates reports purchase_order
Avatar
0
de des. 23
6125
'order' object has no attribute '_line_no' while making custom reports
rml reports purchase_order
Avatar
0
de març 15
4255
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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