Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Artificial Intelligence
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Odoo 19 Enterprise - Customer address in invoice header

Subscribe

Get notified when there's activity on this post

This question has been flagged
invoicexmlstudio
1 Reply
1226 Views
Avatar
Marcos Perez

Good morning,

I’m working with Odoo 19 Enterprise and I need to customize the invoice report.

As usual, to modify the report, I’m using an extension view with XPath.

My client has requested that the customer’s address be moved to the header in order to avoid extra pages when "Verifactu" is added.

I’ve already created the XML to achieve this. I know it’s not the most elegant solution, but it works. However, I’m running into an issue: in preview mode, the address appears at the top as expected, but when I print the invoice, it shows up after the header.

What’s even stranger is that if I use a negative position value, it places the content behind the header.

I’m not sure why this is happening.

XML:

<data>
<xpath expr="//div[@name='address_same_as_shipping']" position="replace">
<div name="address_same_as_shipping">
<t t-set="address">
<div style="position: absolute; top: 50px">
<address class="mb-0" t-field="o.partner_id" t-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: True}"/>
<div t-if="o.partner_id.vat" id="partner_vat_address_same_as_shipping">
<t t-if="o.company_id.account_fiscal_country_id.vat_label" t-out="o.company_id.account_fiscal_country_id.vat_label" id="inv_tax_id_label"/>
<t t-else="">Tax ID</t>: <span t-field="o.partner_id.vat"/>
</div>
<div t-if="o.partner_id.country_code == 'MA' and o.partner_id.company_registry">
ICE: <a t-field="o.partner_id.company_registry"/>
</div>
</div>
</t>
</div>
</xpath>
</data>

Thanks in advance for your help!

0
Avatar
Discard
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer
Hi,

The issue occurs because Odoo uses two different rendering engines for reports: the browser for preview and wkhtmltopdf for PDF printing. While your modification using position: absolute works correctly in preview mode, wkhtmltopdf handles positioning differently and does not respect absolute positioning in the same way. As a result, elements may shift below the header or appear behind it when printed.

This happens because the invoice report is built using web.external_layout, where the header and body are rendered in separate structural sections. Your address block is still part of the body, and CSS positioning cannot reliably move it into the header area in PDF mode.

The correct solution is not to use CSS tricks like absolute positioning or negative offsets, but instead to move the address structurally into the header by inheriting and modifying the web.external_layout template. By placing the address directly inside the header container and removing it from the body, the layout will render consistently in both preview and printed PDF formats.

Hope it helps

1
Avatar
Discard
Marcos Perez
Author

Hello,

Thank you very much for the detailed explanation. I knew that something made it different when previewing and in the actual print.

I did what you told me about putting the address at the top, and it worked!.

Now that I know it can be done, another problem has come up and the question is:

How can I make it so that the address only appears in the invoice reports? Currently, it is shown in all reports. I thought about using "t-if," but what should I compare it with? I can't do something like o.partner_id since each report references the record differently. For example, in quotations, it is referenced as doc.partner_id.

Enjoying the discussion? Don't just read, join in!

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

Sign up
Related Posts Replies Views Activity
XML ITALIA INVOICES are not created for goods sold abroad Solved
invoice xml
Avatar
Avatar
2
Mar 26
1067
How can i decorate or customize badge widget using Odoo: Studio ONLY Solved
xml studio
Avatar
Avatar
1
Jan 26
1370
Add a "last page" in invoices with terms & conditions
invoice studio
Avatar
Avatar
2
Mar 25
3212
Display VAT on the invoice using Odoo Studio Solved
invoice studio
Avatar
Avatar
2
Jan 21
6260
Studio changes create a big mess in XML Solved
xml studio
Avatar
Avatar
1
Mar 25
4407
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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