how to display binary field data in website using a controller odoo 13

99封情书 提交于 2020-07-23 06:45:29

问题


I was creating a controller to gets information from custom module and wonted to display the pdf or image on the website how to get the url. I was able to download it using this

return http.send_file(maybefiel, filename='sdsdds', as_attachment=False)

but I wonted to display it can you please help


回答1:


You can access a binary field using the following path:

your_url/web/content/model_name/id/field_name

For example, the field name of a user's profile picture is called "image", so, the URL looks like something like this:

http://localhost:8069/web/content/res.users/1/image

Where 1 is the user id.



来源:https://stackoverflow.com/questions/62908614/how-to-display-binary-field-data-in-website-using-a-controller-odoo-13

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!