Odoo Help

1

Where does « o.name » take his value?

By
Pascal Tremblay
on 12/31/14, 10:00 PM 1,529 views

Hello all!

We have this view : report_overdue

<?xml version="1.0"?>

<t t-name="account.report_overdue">

<t t-call="report.html_container">

<t t-foreach="doc_ids" t-as="doc_id">

<t t-raw="translate_doc(doc_id, doc_model, 'lang', 'account.report_overdue_document')"/>

</t>

</t>

</t>

 

We also have this view : account.report_overdue_document

<?xml version="1.0"?>

<t t-name="account.report_overdue_document">

<t t-call="report.external_layout">

<div class="page">

<div class="row">

<div class="col-xs-5 col-xs-offset-7">

<span t-field="o.name"/>

 </div>

</div>

 </t>

</t>

 

I don't understand how o.name can return a value since it is not declared... There is no « t-foreach="" t-as="o" » before in the view... COuld you help please.... 

Where did the « o » variable takes his value?

 

3
Anil R. Kesariya
On 1/1/15, 2:59 AM

@Pascal

If we not define for each look, by defaut current model objects set, that record coming thourgh context,

you can find code inside base addons module name with report

Inside the source code : odoo>>addons>>report>>models>>report.py

When your report template render it is updated in context value you can code from line 121 :130 than you will get idea.

Hope this will helps you.

Regards,

Anil.

 

 

2

Hi,

This "o" is automatically set the docmunet object with current ID for current Model. And also you can get the Objects as like "o" for more then one objects.

You can see it is define in the file : report => models => report.py 

In the following class.

class Report(osv.Model):
    _name = "report"
    _description = "Report"

 

....

I hope it is very useful for you.

thanks

Pascal Tremblay
on 1/2/15, 6:21 AM

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

2 follower(s)

Stats

Asked: 12/31/14, 10:00 PM
Seen: 1529 times
Last updated: 3/16/15, 8:10 AM