Odoo Help


2 Answers

Stephen Mack

--Stephen Mack--

| 9 8 11
Santiago, Cile
--Stephen Mack--

Some people call me a karma whore, I only ask for 10 points if you like my answer and 15 if I happen to get it correct.

Stephen Mack
29/01/15, 08:21

There is a GitHub Issue #4461 on this problem.

UPDATE: A patch to v8 was released and some good programming suggestions were made by Olivier on how to avoid using loops.

1 Comment
Stephen Mack
30/01/15, 09:00

Updated my answer with the patch.


Vasiliy Birukov

--Vasiliy Birukov--
| 8 6 10
Togliatty, Federazione Russa
--Vasiliy Birukov--

Help develop and implement any project on base Odoo.

Vasiliy Birukov
30/01/15, 00:04

Thank you Stephen Mack !

As a workaround we can use:

1) If you can insert output in last iteration then use like:

                <t t-set="total" t-value="0" />
                <t t-foreach="o.order_line" t-as="line">
                    <t t-set="total" t-value="total+line.quantity" />
                    <t t-if="line_last">
                        <t t-esc="total" />

​​2) If you can't insert output in loop then use like:

                <t t-set="total" t-value="sum([line.quantity for line in o.order_line])" />

Stephen Mack
30/01/15, 06:00

Those are some ugly workarounds. But thanks for posting them.

Vasiliy Birukov
30/01/15, 07:49

I agree :(

Ask a Question
Keep Informed
1 follower(s)
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 eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now