Search code examples
python-3.xodooodoo-13

How Odoo get images


I would like to know if I enter any image path with module name like

https://demo.com/web/static/img/preview_background.png

then it will render image.

I can't find the controller/method that is called after entering an image path. I tried to find and spend hours but nothing found. My lots of work is depending on it. Can anyone help me to find a solution?

Thanks in advance.


Solution

  • the paths for the static resources are directly injected into the werkzeug.wsgi.SharedDataMiddleware and normally bypass/are not handled by the controllers.

    see odoo.http.Root.load_addons: https://github.com/odoo/odoo/blob/f705c4088ea7584b17769220a0a7ffcb00546e0b/odoo/http.py#L1289

    if you want to override it you would have to patch the DisableCacheMiddleware in a server wide module.