如何使用控制器odoo 13在网站中显示二进制字段数据 [英] how to display binary field data in website using a controller odoo 13
本文介绍了如何使用控制器odoo 13在网站中显示二进制字段数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个控制器来从自定义模块获取信息,并习惯于在网站上显示 pdf 或图像如何获取 url.我可以使用这个下载它
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
返回 http.send_file(maybefiel, filename='sdsdds', as_attachment=False)
但我习惯显示它你能帮忙吗
but I wonted to display it can you please help
推荐答案
您可以使用以下路径访问二进制字段:
You can access a binary field using the following path:
your_url/web/content/model_name/id/field_name
例如,用户的个人资料图片的字段名称称为图片",因此,该 URL 看起来像这样:
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
其中 1 是用户 ID.
Where 1 is the user id.
这篇关于如何使用控制器odoo 13在网站中显示二进制字段数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文