Odoo Help

0

0
2 Answers
0
Avatar

Mitul Shingala

--Mitul Shingala--
--Mitul Shingala--

Odoo Developer

Mitul Shingala
14/06/19 09.59

hello

you can call the method from the xml

like

see the below link: 

from xml call method like here call the method get_months : 

<t t-foreach="get_months" t-as="month"> (you can use <span t-esc="method_name"/> also for print the data on report.)

https://github.com/odoo/odoo/blob/12.0/addons/hr_holidays/report/hr_holidays_templates.xml#L18


into .py render method. so from xml access the key 'get_months' and from that call the method. and from that self._get_method is doing the calculation(as per your need.)

from dictionary ket it call the method like =>  'get_months': self._get_months(data['form']['date_from']),

https://github.com/odoo/odoo/blob/12.0/addons/hr_holidays/report/holidays_summary_report.py#L123

0
Avatar
--Haresh Kansara--

Odoo Application Engineer

I have completed odoo training from Odoo India, and i have formerly worked there as an application engineer. And currently works as an application engineer. 

I have worked on different projects like Sales, Purchase, MRP, Account etc. I have also worked on website development.

I can help you to:

- Develop new module

- Customise existing module

- Provide Odoo Functional / Technical training

Connect me at: https://www.linkedin.com/in/haresh-kansara-50048914b

Haresh Kansara
14/06/19 11.09

Hi Akshay,

You can write code like:

<t t-set="total_value" t-value="o.do_calc()"/>

<t t-esc="total_value"/>

Here o means self(current object) or you can use any model's method like 

<t t-set="total_value" t-value="request.env['model.name'].do_calc()"/>


 Hope it will helpful for you.


Thanks and regards

Haresh Kansara

Ask a Question
Writer
Tag
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.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now