Se rendre au contenu
Menu
Cette question a été signalée

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
Ignorer

request.redirect ?

Hi Rui! Any luck with this?

Auteur

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.

Publications associées Réponses Vues Activité
2
août 25
2437
1
juil. 25
1747
2
juin 25
805
3
févr. 25
14941
1
avr. 25
2079