Skip to Content
Menú
This question has been flagged
2 Respostes
150 Vistes

I want to override parts of the invoice template. Neither Google, ChatGPT, Claude or the Odoo documentation can help me with this.

What I want to do is pretty simple. If the address is a contact under a company it's formatted this way:

[Company Name], [Name Contactperson]

But what I want is this:

[Company Name]
T.a.v. [Name Contactperson]

Who can help me with this or at least point me in the right direction?

I use Odoo 18 Online and I have access to Odoo Studio.

Cheers!

Avatar
Descartar

If you're struggling to find the template code responsible for generating template:
Go to any Invoice (Accounting/Invoicing App > Open Studio > Click on "Reports" > Choose "Invoice PDF" > happy coding).
Then you'll probably have to adjust template (not sure if Studio replaces the code, or just create new, inheriting QWeb Template, you'd need to find out), or use the solution suggested by @Marawan Ahmed.

Best Regards,
Dawid Gacek, Adapt IT (adapt-it.pl)

Autor Best Answer

Thanks Dawid. The problem isn't finding the place where to change the code. It's completely unclear and undocumented what I have to change in which template. There is so much inheritance that I can't find where for instance the code is that formats the address.

Avatar
Descartar

So in the it is a call to other template named web.address_layout​. You can find web.address_layout​ code by going to Settings > Technical > Views (under User Interface), and search for address_layout​.

There is not much in web.address_layout​ template, but it is some lead. I think (not 100% sure), that <html> field company.company_details​ is used there, somehow. I agree that it is not the most obvious to find it, but good luck.

Best Regards,

Dawid Gacek, Adapt IT

Best Answer

You want the address format in Odoo 18 Online to look like this:

[Company Name] T.a.v. [Contact Name]

instead of the default:

[Company Name], [Contact Name]

Solution

Since you are on Odoo 18 Online (SaaS), you don’t have access to the backend code, but you do have Odoo Studio, which is enough to customize reports and fields.

Option 1: Customize Report Template in Studio

  1. Open any report (e.g., Quotation, Invoice).
  2. Click Edit with Studio.
  3. Locate the Address Block that prints the partner’s details.
  4. Replace the content with:

    ${object.parent_id.name or ''} ← Company Name T.a.v. ${object.name or ''} ← Contact Name

    parent_id = company, name = contact.

Option 2: Create a Custom Field with Computed Value

If you want this format as a field you can reuse:

  1. In Studio, create a new field (e.g., “Formatted Address”).
  2. Set it as a Computed Field with this formula:

    (record.parent_id.name or '') + '\nT.a.v. ' + (record.name or '')

Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de des. 24
3377
3
de març 25
1068
2
de maig 24
1400
1
de febr. 24
1492
1
d’abr. 25
136