Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
16312 Vizualizări

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?
 

Imagine profil
Abandonează
Cel mai bun răspuns

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):
        do_what_you_need_to_do()
        return super(Extension, self).
report_download(data, token)

Imagine profil
Abandonează
Autor

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

Autor Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
sept. 16
3639
3
nov. 21
8153
1
mar. 19
6826
5
iun. 17
9028
5
nov. 16
6876