Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
6864 Visualizzazioni

I want to be able to execute a data export from within a common method (Odoo v8)

All is done up to the point in which I have to call the "[URL]/web/export/csv" router.

Apparently, despite this being executed by ir.cron, the user session is not recognized and the controller returns a result just as if it had been called by an "outsider".


Has anyone done this? I'm sure this has to do with the way the http request is being done.

requests.post("http://www.whatever.xpto/web/export/csv",data=data)


By the way, if I pick the URL (along with the JSON) and just put it in the browser's address (logged in), I get the csv file.

Avatar
Abbandona

request.redirect ?

Hi Rui! Any luck with this?

Autore

No. I had to find another way of doing the job.

Mind to share your way? I'm trying to do the exact same thing as yours, and have been following Temur's answer on https://www.odoo.com/forum/help-1/question/how-to-invoke-a-controller-function-from-inside-a-model-function-87620. I have successfully called the base method using his suggestion but the request object inside it is somehow a JsonRequest not an HttpRequest which causes an error.

Post correlati Risposte Visualizzazioni Attività
2
ago 25
2437
1
lug 25
1747
2
giu 25
805
3
feb 25
14941
1
apr 25
2079