Skip to Content
Menu
This question has been flagged
3 Replies
4975 Views

Hi all,

I want change the formatting of the sales invoice and want add same fields. Therefore in former versions the changing of the view report_invoice_document was the way. 

In odoo 16 the changing of report_invoice_document is not recommended. Even I have done it, but the strange thing is, that the changes are not loaded. 

If I do changes in the view external_layout_din5008 for the header or footer the changes are load.


Why the changes of report_invoice_document are mot loaded? What is the correct way for customizings of reports in general?

Best regards

cakbulut

Avatar
Discard
Author Best Answer

Hi all, 

thanks for your answers. I know understand the logic where the field on the invoice came. I have select din_5008 template, so that the header field are loaded in view "l10n_din5008.external_layout_din5008". There are the following lines which determine fields for the header of the report like invoice or sales order report:

                             



Now my question is, how I can extend the template_data collection for each report, if I want use the din_5008?


Best regards

cakbulut


Avatar
Discard
Best Answer

Hi,

We can inherit the report_invoice_document and add the corresponding changes to the file.

<template id="report_invoice_customized" inherit_id="account.report_invoice_document">
      <xpath expr="//tr[hasclass('is-subtotal')]" position="after">
       <tr>
           <td>Discount</td>
           <td class="text-right">
               <span t-field="o.amount_discount"/>
           </td>
       </tr>
   </xpath>
</template>


for example, hereafter the subtotal row added a new row for Discount similarly, we can load the header, footer, etc.

Regards

Avatar
Discard
Best Answer

Hi,

The best and recommend way to customize the report is by creating an inherited template, if you modify the template directly as you have mentioned in the question, the applied changes can be overwritten/lost on the future upgrade of the module.

So the best way to achieve the same is to apply the changes from an inherited template or via odoo studio.


In your case, the changes are not reflected after modifying the layout, you have to check and see few things:

1. Is this part of template modified from any other templates ?
2. Is reload from attachment is ticked in the report ? If yes, it will be printed from the attachment, instead of generating new one


To customize report from ui using the inheritance, see this:  Customize PDF Reports From User Interface In Odoo


Thanks

Avatar
Discard