Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • E-learning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Artificiële Intelligentie
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelwinkel
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Horeca & Hospitality
    • Bar en café
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van mede-eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brouwerij
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Diensten
    • Klusjesman
    • IT-hardware & ondersteuning
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Alle bedrijfstakken bekijken
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijsprogramma
    • Scale Up! Business Game
    • Odoo bezoeken
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Partner worden
    • Diensten voor partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Modifying Purchase Order Report - Odoo Online

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
inheritancereportspurchase_order
2 Antwoorden
876 Weergaven
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
Annuleer
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Beste antwoord

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
Annuleer
Avatar
Zehntech Technologies Inc.
Beste antwoord

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
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
RfQ/PO don't use supplier or manufacturer product name/nr
reports purchase_order
Avatar
1
apr. 26
4052
Loading for forever on clicking on save button.
inheritance purchase_order loading
Avatar
Avatar
1
jul. 23
3765
Purchase order READONLY_STATES inherit
inheritance purchase_order odoo9
Avatar
Avatar
1
jul. 23
6353
Modify report template request for quotation and order
templates reports purchase_order
Avatar
0
dec. 23
6182
'order' object has no attribute '_line_no' while making custom reports
rml reports purchase_order
Avatar
0
mrt. 15
4298
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Partner worden
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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