Odoo Help


How we can update dictionary in qweb report ?

Jaydeep Barot (jar)
on 4/26/16, 3:21 AM 1,850 views

How we can update dictionary in python ?

"update" key is not working in qweb.

<t t-set="my_dict" t-value="{}"/>
<t t-foreach="['name'] t-as="key">
    <t t-foreach="['abc', 20] t-as="value">
        <t t-set="my_dict" t-value="my_dict.update({key:value})"/>
<span t-esc="my_dict"/>

my_dict is display none.

you should write the function the python code and call it back in the xml Example: - python: from openerp.report import report_sxw from openerp.osv import osv class example_class(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(sale_common, self).__init__( cr, uid, name, context=context) self.localcontext.update({ 'update_your_dict': self.update_your_dict }) def update_your_dict(self, o): # your source code here return true - xml: Demo Function Python:

Anh Vu
on 4/26/16, 6:05 AM

Thanks Anh Vu But I have to do in xml file not in py file.

Jaydeep Barot (jar)
on 4/26/16, 6:09 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.


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

3 follower(s)


Asked: 4/26/16, 3:21 AM
Seen: 1850 times
Last updated: 9/25/17, 7:58 AM