Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to generate serial number and total quantity in qweb report without parser file ?

Ankit H Gandhi(AHG)
on 6/18/15, 1:56 AM 1,817 views

Hello Everyone,

I want to generate dynamic serial number and also generate total quantity without parser file.

here given example to more clarify.

serial no                                              product                                description                                quantity                                 Total 

1                                                          any product                              -                                           2                                              -

2                                                               -                                          -                                            2                                              -

3                                                               -                                          -                                            2                                              -

?                                                               -                                          -                                            2                                              -

?                                                               -                                          -                                            2                                              -

?                                                               -                                          -                                            2                                              -

Total quantity                  ?(12)

we can generate serial number using parser file but I want generate serial number and total quantity without parser file

Thanks in advance

I've updated my post. Hope this helps.

Shawn Varghese
on 6/23/15, 7:11 AM
Shawn Varghese
On 6/22/15, 3:07 PM

Do you mean that you want to dynamically compute serial numbers and quantity in qweb?

You could try something like this for serial number:

<t t-foreach="o.lines" t-as="p">
<span t-esc="p_index">

The "_index" is automatically understood by qweb to generate the index number

If you want to create your own, you could try something like:

<t t-set="i" t-value="1" /> 
<t t-foreach="o.lines" t-as="p">
<span t-esc="i">
<t t-set="i" t-value="i+1"/>


For adding quantity dynamically, I assume your code to display quantity looks something like this:

<t t-foreach="o.lines" t-as="p">
<span t-esc="p.quantity">

You need to initialize a variable before the loop, and simply add the quantity to it for each iteration:

<t t-set="i" t-value="0" /> 
<t t-foreach="o.lines" t-as="p">
<span t-esc="i">
<t t-set="i" t-value="i+p.quantity"/>

<t t-esc="i" />

This way you should get the quantity

Let me know if this doesn't work

Thanks @Shawn this code is very help for me to generate dynamically serial number in qweb report can you little help for how to generate dynamic total quantity ?

Ankit H Gandhi(AHG)
on 6/23/15, 1:36 AM

Thanks again @Shawn Your updated code is fully work.Now I get the total quantity dynamically without parser file.

Ankit H Gandhi(AHG)
on 6/23/15, 8:12 AM

Axel Mendoza

--Axel Mendoza--
| 6 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 10/15/15, 5:57 AM

Check this post

I write a more extensive explanation of qweb report parsers at:


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 6/18/15, 1:56 AM
Seen: 1817 times
Last updated: 10/15/15, 5:57 AM