コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
3387 ビュー

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?

アバター
破棄
最善の回答

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 

アバター
破棄
著作者 最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
1
8月 22
3013
2
1月 18
4676
2
8月 25
522
5
8月 25
10010
2
7月 25
1057