Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
3346 Vizualizări

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?

Imagine profil
Abandonează
Cel mai bun răspuns

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 

Imagine profil
Abandonează
Autor Cel mai bun răspuns

@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. 😒 

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
aug. 22
2978
2
ian. 18
4644
2
aug. 25
407
5
aug. 25
9965
2
iul. 25
1024