Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
3366 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor Nejlepší odpověď

@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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
srp 22
2995
2
led 18
4661
2
srp 25
482
5
srp 25
9985
2
čvc 25
1031