Odoo Help

0

Why is the template renderer changing the object reference passed as data?

By
Ratmil Torres
on 2/15/17, 1:20 PM 363 views

I have the following template:

<t t-name='test_template'>
     <t t-call="other_template"/>
</t>

And I have the following code:

alert(data['items'].length);
var html = $(this.qweb.render("test_template", {'data' : data}));
alert(data['items'].length);


The first alert is showing 30. The second one is showing 1.

Why is the template renderer changing the object reference passed as data?

This only happens when using sub-template calling.

0
Ratmil Torres
On 2/15/17, 4:04 PM

It was my own fault. The problem was in another template.

I had somethine like this:

<t t-if="items.length > 1">

And I the correct code is:

<t t-if="items.length &gt; 1">

">" is a special character in xml.

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.

Register

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)

Stats

Asked: 2/15/17, 1:20 PM
Seen: 363 times
Last updated: 2/15/17, 4:04 PM