Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
3362 Vues

How can I  run a code block on every request a website user makes. Let's say I want to pre-select the pricelist based on the user ip, how do I run a pre-controller hook or middleware?

Avatar
Ignorer
Meilleure réponse

request dispatch method will call on every request 
https://github.com/odoo/odoo/blob/14.0/odoo/http.py#L1306

you can override the despatch for both http or json request 

Avatar
Ignorer
Auteur Meilleure réponse

@Ravi Gadhia

Thank you so much!!! I had to monkey patch the whole  HttpRequest class, but it was worth it. You have no idea how helpful it was.

PS: I do not have enough karma to mark this as solved. 😒 

Avatar
Ignorer
Publications associées Réponses Vues Activité
1
août 22
2991
2
janv. 18
4648
2
août 25
459
5
août 25
9982
2
juil. 25
1027