Odoo Help


Product Label - Is loop on product_qty in QWeb possible?

Mathias Neef
on 1/25/15, 5:15 PM 1,739 views


At the moment I am working on a product label which the user can print after it is delivered into stock.

My qestion is: is there a way to do a loop on the quantity only within the QWeb-XML? E.g. products_qty = 20 it will do something like

<t t-for="quantity" t-in="move.products_qty">
    Product-Name - EAN...

(which is not working) and print the label 20times. 

Sajin Aziz
On 1/26/15, 12:47 AM

Try this,

 <t t-foreach="range(1, move.products_qty + 1)"  t-as="r">
       <p t-esc="r"/>

       <!--Product Name  -->


Thank you Sir! With just a little change it works perfectly:

Mathias Neef
on 1/26/15, 2:18 AM
Mathias Neef
On 1/26/15, 2:22 AM

The above code in my comment was unfortunately not printet.

As products_qty is a float I just changed it to int():
 <t t-foreach="range(1,
int(move.products_qty) + 1)"  t-as="r">

       <p t-esc="r"/>

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 1/25/15, 5:15 PM
Seen: 1739 times
Last updated: 3/16/15, 8:10 AM