Odoo Help


How to override ReportController class in Odoo

Shawn Varghese
on 2/19/15, 6:31 AM 4,699 views

I want to override the report_download method in the addons/report/controllers/main.py file. but I do not know how to inherit the ReportController(Controller) class. I understand that inheriting a controller is not the same as the other classes. Can anyone please help me out?

Gael Rabier
On 2/19/15, 8:37 AM

I would suggest to do this:


from openerp import http
from openerp.http import request
import openerp.addons.report.controllers.main as main

class Extension(main.ReportController):

    @route(['/report/download'], type='http', auth="user")
    def report_download(self, data, token):
        return super(Extension, self).
report_download(data, token)

Yup, this would be a cleaner way to do it. Thanks Gael.

ePillars Systems LLC, Shawn Varghese
on 2/19/15, 8:41 AM

Shawn Varghese

--Shawn Varghese--
| 5 3 7
Dubai, United Arab Emirates
--Shawn Varghese--

Shawn Varghese
On 2/19/15, 8:35 AM

Ok got it.

from openerp.addons import report

class ReportControllerDerived(report.controllers.main.ReportController):

@route(['/report/download'], type='http', auth="user")

def report_download(self, data, token):

///remaining code

I had not referenced the base class correctly earlier

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: 2/19/15, 6:31 AM
Seen: 4699 times
Last updated: 2/22/18, 9:30 PM