Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
123 Widoki

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!

Awatar
Odrzuć

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 Najlepsza odpowiedź

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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 '')

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
gru 24
3373
3
mar 25
1068
2
maj 24
1395
1
lut 24
1490
1
kwi 25
136