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 a class in Jasper Reports?

By
Odooveloper (by Rui Franco)
on 10/17/14, 12:13 PM 689 views

I really need to make a change to JasperReports but I'm not able to inherit and override a method.

In /JasperReports/JasperServer.py or /jasper_report.py, I need to change the "execute" method.

class Report:
    def __init__(self, name, cr, uid, ids, data, context):
        etc...
        etc...

    def execute(self):


How can one do this since the class has no name for us to declare the inheritance?

0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 10/20/14, 7:56 AM

Rui, the Report is not an osv/orm Class, but a normal Python class.  So you can use normal Python inheritance for your purpose.

Thanks. So, following an example I found, what I did was: class Report(): def __init__(self, name, cr, uid, ids, data, context): Report.__init__(self) It didn't work. Not even the init was being executed.

Odooveloper (by Rui Franco)
on 10/21/14, 5:01 AM

I can point out that your code did not perform any inheritance at all. If you inherit a class in Python, you need to include it in the class definition, e.g. class My_Report(Report): ..... Do familiarize yourself with python language and inheritance or get help from someone who does. I can't say that I'm an expert.

Ivan
on 10/21/14, 9:27 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

1 follower(s)

Stats

Asked: 10/17/14, 12:13 PM
Seen: 689 times
Last updated: 3/16/15, 8:10 AM