Skip to Content
Menu
This question has been flagged

Hello, I need help and I have a question about invoice editing (report) : 

So basically as you may know via the settings in Odoo, we can choose and web external layout for all documents (light - striped - bold - boxed), so I use the striped that uses the "web.external_layout_striped" view for all reports pdf (purchase order, invoice document...)

But I want to apply modifications on the "web.external_layout_striped" that are only visible for invoice documents, how can I do that by inheriting in XML the view  "web.external_layout_striped" ? Maybe with a specific "IF" statement?

Example : If I inherit the "web.external_layout_striped" view and add a div on it, the div will appear on all documents, I don't want that, I want the div to only be visible for invoice documents.

Thanks ! 

Avatar
Discard
Best Answer

Hi,

To make any customization in the report layout striped you can inherit the template "web.external_layout_striped" and if you want to add the customization only for the invoice module please try with adding a condition "t-if="o._name == 'account.move'""


example


<template id="inherit_external_layout_striped"
inherit_id="web.external_layout_striped">

             <div t-if=o._name == 'account.move'>

         

            # Your custom code

              

            </div>
<xpath expr="//t[@t-call='web.external_layout_striped']" position="replace">

        </xpath>

</template>


Hope it helps

Avatar
Discard
Author Best Answer

Hello Jort, first thanks for your answer, 

Can't i do that by inheriting the web.external_layout_striped view? I prefer to use this model for all reports (especially the grids), because as I understand your post on your blog, we create another custom layout, is it not possible to inherit an existant layout? 

Sincerly yours

Avatar
Discard

The web.external_layout_striped view layout uses the attribute t-att-data-oe-model="o and o._name", e.g., <span t-field="o.name"/>. So you could try to use (e.g., t-if) specific invoice related items using o.item. But this really depends on your use case.

Best Answer

The items displayed on the invoice are specified in the report_invoice_document​ template from the account module: https://github.com/odoo/odoo/blob/16.0/addons/account/views/report_invoice.xml. So you would need to extend this template to add your modifications. See this post: https://www.odoo.com/forum/help-1/add-bank-account-number-under-company-details-of-a-invoice-odoo-16-community-edition-236599#answer-236603

I hope this helps!

Avatar
Discard
Related Posts Replies Views Activity
1
Dec 23
1897
3
Mar 15
5617
0
Mar 15
3683
0
Mar 24
1317
0
Nov 23
892