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="{"widget": "contact", "fields": ["address", "name"], "no_marker": 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!