Odoo Help

Welcome!

This community 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.

0

How we can update dictionary in qweb report ?

By
Jaydeep Barot (jar)
on 4/26/16, 3:21 AM 631 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})"/>
    </t>
</t>
<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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 4/26/16, 3:21 AM
Seen: 631 times
Last updated: 6/14/16, 7:59 AM