Ir al contenido
Menú
Se marcó esta pregunta
6876 Vistas

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
Descartar

request.redirect ?

Hi Rui! Any luck with this?

Autor

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.

Publicaciones relacionadas Respuestas Vistas Actividad
2
ago 25
2439
1
jul 25
1748
2
jun 25
807
3
feb 25
14942
1
abr 25
2081