Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
2584 Prikazi

Hello guys 
I want to display total no of items purchased or total quantities on the invoice while printing.
I have tried to inherit the template ID and add the sum fields but it is not working 

Please help

How can I display the total quantities on the invoice report.



Avatar
Opusti
Best Answer

Hi,

To add the total number of quantities in the invoice report, Try below code


<template id="inherit_report_invoice_document"
inherit_id="account.report_invoice_document">
<xpath expr="//tbody[hasclass('invoice_tbody')]"
               position="inside">

               <t t-set="quantity_set" t-value="0.0"/>

       </xpath>

<xpath expr="//td[@name='account_invoice_line_name']"

               position="after">

               <t t-set="quantity_set" t-value="quantity_set + line.quantity"/>

       </xpath>

        <xpath expr="//t[@t-foreach='lines']"

position="after">

               <div>Total Quantity : <t t-out="quantity_set"/></div>

</xpath>


</template>


Add the above code in your custom module, and the output be like


Hope it helps

Avatar
Opusti
Best Answer

With great difficulty as Odoo in their wisdom have removed functionality in relation to the use of Studio to make very simple changes to a VERY IMPORTANT DOCUMENT of a business INVOICES and quotes etc. Errordoo strikes again. Thanks Odoo great work. We currently have people paying us a tax free total amount as this unchangeable value is on our invoices. Geez when was 17 released Hmmm a long time ago.

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
jul. 25
500
2
jun. 25
1878
3
feb. 25
2712
1
nov. 24
2450
4
maj 24
6009