Odoo Help


webkit report. get data from another model. odoo 8

on 12/31/14, 6:26 AM 1,567 views

hi everyone.

I have been using webkit report and, as far as I know, I can only get data from current model, pointed in the xml of reports description. ANd i know that I can get data using the link between models, but I don't know how to get data from the model which isn't linked with the current model.

I should underline - Webkit Reports!

Thank you so much.

P.S. I know that it's deprecated :) 


Timo Talvitie, Vizucom Oy

--Timo Talvitie, Vizucom Oy--
| 5 4 7
Tampere, Finland
--Timo Talvitie, Vizucom Oy--

Lead developer at Vizucom.

Timo Talvitie, Vizucom Oy
On 1/2/15, 7:14 AM

Hi, you can do this by overriding the default report parser, and adding the desired data to the localcontext variable in its init method. Here's a python snippet that will hopefully help.

# -*- coding: utf-8 -*-
from openerp.report import report_sxw
from osv import osv

class sale_order_report_parser(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
       super(sale_order_report_parser, self).__init__(cr, uid, name, context=context)

       # Add a new key/value pair to localcontext. Instead of a simple string you can use self.pool.get here to access other models and pull data from there
       test = "Just testing"

       self.localcontext.update({'new_variable': test })

# Tell your report to use the new parser


After this, you can access new_variable in your mako file.

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

1 follower(s)


Asked: 12/31/14, 6:26 AM
Seen: 1567 times
Last updated: 4/6/15, 6:09 AM