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 to inherit from rml_parse class and others ?

By
Yug Faa
on 2/19/14, 7:38 AM 1,352 views

Hello everybody,

I want to inherit from the class rml_parse for adding some keys on localcontext :

I tyed this :

class rml_parse(rml_parse):
    def setCompany(self, company_id):
        super(rml_parse,self).setCompany(company_id)
        self.localcontext['mykey'] = 'vim6574'

The syntax is good, i have imported all class needed, the problem is when I print a report, this classs is not called, is there a way to define a global context within localcontext, because I need this value on all report

Thank you so much.

0
Sajad KK
On 2/20/14, 12:56 PM

Try this

class rml_parse(rml_parse):
    def setCompany(self, company_id):
        super(rml_parse,self).setCompany(company_id)

    def __init__(self, cr, uid, name, context):
        super(rml_parse, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({'mykey': 'vim6574',
                                  'setCompany': self.setCompany,})

Doesn't work, the same problem, I tried this way, the class rml_parse is defined out of addons, and when I inherit in my module and when I print, the function above is not called, this is the problem, Thank you

Yug Faa
on 2/20/14, 6:25 PM

Did you import it correctly in your report parser? can you show your full code?

Sajad KK
on 2/20/14, 11:37 PM

from openerp.report.report_sxw import rml_parse This class is called just one time when restaring OpenERp, but when I print It doesn't invoked

Yug Faa
on 2/25/14, 7:06 PM

you should import your rml_parse class not openerp.report.report_sxw import rml_parse

Sajad KK
on 2/25/14, 10:58 PM

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

1 follower(s)

Stats

Asked: 2/19/14, 7:38 AM
Seen: 1352 times
Last updated: 3/16/15, 8:10 AM