Hello,
I have created a new studio field on invoice and would like to add it to pdf formular as well.
How can i add it in V18.
Thanks in advance for your help.
BR
Sabine
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
I have created a new studio field on invoice and would like to add it to pdf formular as well.
How can i add it in V18.
Thanks in advance for your help.
BR
Sabine
Hi.
Please refer to the following
* https://www.youtube.com/watch?v=5jrwei9tM8s
* https://www.youtube.com/watch?v=iFghjU_hWMQ
* https://www.youtube.com/watch?v=noerlmsGgMg
Hope it helps
Hi Sabine,
Adding a new studio field to a PDF form in V18 typically involves a few steps, often requiring customization of the PDF template. Here's a general approach:
First, you need to determine which PDF template your invoices are using. In Odoo V18, you can usually find this by going to:
Odoo's PDF reports are usually generated using QWeb views. You'll need to find the specific QWeb view that renders the invoice details. You can usually find this by:
You should not directly modify the original Odoo QWeb view, as your changes would be lost during an update. Instead, you should create a new module and inherit or extend the existing view.
Here's a conceptual outline of what you'd do in your custom module's XML file:
XML
<odoo> <data> <template id="report_invoice_document_inherit_my_module" inherit_id="account.report_invoice_document"> <xpath expr="//div[@id='informations']" position="after"> <!-- Or find a more appropriate location based on the original template's structure --> <div class="row mt32 mb32"> <div class="col-auto mw-100 mb-2"> <strong>My New Studio Field:</strong> <p t-field="o.x_your_studio_field_name"/> </div> </div> </xpath> </template> </data> </odoo>
Explanation:
After adding this XML file to your custom module and ensuring it's loaded (e.g., via __manifest__.py), you'll need to update your module in Odoo:
Let's say you added a Studio field called "Customer Reference Number" with the technical name x_customer_ref_number to your account.move model. You want it to appear just below the "Payment Term" on the invoice PDF.
You would inspect the account.report_invoice_document view and find the section for payment terms. Let's assume it looks something like this:
XML
<div t-if="o.invoice_payment_term_id" class="col-auto mw-100 mb-2">
<strong>Payment Term:</strong>
<p t-field="o.invoice_payment_term_id.name"/>
</div>
Then your XPath might target this div:
XML
<template id="report_invoice_document_inherit_my_module" inherit_id="account.report_invoice_document"> <xpath expr="//div[contains(@t-if,'o.invoice_payment_term_id')]" position="after"> <div class="col-auto mw-100 mb-2"> <strong>Customer Reference:</strong> <p t-field="o.x_customer_ref_number"/> </div> </xpath> </template>
This process can be a bit tricky if you're not familiar with QWeb. If you're comfortable with XML and Odoo's technical aspects, it's definitely doable.
Let me know if you have the technical name of your field and can locate the specific report, and I can try to give more tailored advice!
Hope this helps!
Create an account today to enjoy exclusive features and engage with our awesome community!
Реєстрація