Odoo Help


1 Answer

Axel Mendoza Cuba

--Axel Mendoza--
| 8 8 10
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza Cuba
2/12/16, 12:11 PM

Hi @Pascal

Very good question, I didn't ask that for myself. 

The real answer is no because we are in python, in other strongly typed programming lang the answer would be yes.

The only thing that we do when we define a parser is inherit from report_sxw.rml_parse to add our methods and values into the localcontext dict value by reimplementing the __init__ method to add our stuffs but Odoo 8 do not anything of that, it's just using report_sxw.rml_parse to build the self.localcontext dict and to call the set_context method. The new report api jus do this with the wrapper_report_class

# Generate the old style report

wrapped_report = self._wrapped_report_class(cr, uid, '', context=context)

wrapped_report.set_context(objects, data, context['active_ids'])

# Rendering self._template with the wrapped report instance localcontext as

# rendering environment

docargs = dict(wrapped_report.localcontext)

So you can do this:

class report_parser(object):
    def __init__(self, cr, uid, name, context):

self.localcontext = {

'next_seq': 'value',

'select_value': self._function,


def set_context(self, objects, data, ids, report_type = None):

self.localcontext['data'] = data

self.localcontext['objects'] = objects

class report_test1_parser(models.AbstractModel):

_name = 'report.parser_test_module.report_test1'

_inherit = 'report.abstract_report'

_template = 'parser_test_module.report_test1'

_wrapped_report_class = report_parser

So no need to inherit form the old api report_sxw.rml_parse

La Page PT, Pascal Tremblay Canada
2/12/16, 12:26 PM

You are really a beast. Thanks.

Axel Mendoza Cuba
2/12/16, 12:27 PM

Good questions gets good answers

Ask a Question
Keep Informed
2 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.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now