python - Openerp-如何删除图像上的编辑选项?

标签 python xml odoo

我有这个相关图像(只读)字段,一旦我单击编辑,该特定图像字段就会在表单 View 中显示编辑选项。请帮我删除它

字段:-

'emp_img':fields.related('employee_id', 'image_medium', type='char', relation='hr.employee', string='', store=True),

在 xml 中:-

<field name="emp_img" readonly="1" widget='image' class="oe_left oe_avatar" />

在表单 View 编辑中显示如下:

enter image description here

最佳答案

您必须将 effective_readonly 参数传递给管理图像的 image 小部件。

以下应该有效:

<field name="emp_img" readonly="1" widget='image' class="oe_left oe_avatar" attrs="{'effective_readonly': True}" />

或者您可以在 Debug模式下将下面的属性添加到您想要的表单上:

attrs="{ &quot;effective_readonly&quot;:True}"/>

关于python - Openerp-如何删除图像上的编辑选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43180422/

相关文章:

python - Slack 机器人 : invite a non-bot user when @ mentioning them

Python 数据帧 : Merge values of columns according to a specific condition

python - Pandas read_csv 到多个 DataFrame 中

xml - 更正 Google 多语言站点地图/xhtml 的 XSLT 语法 :link

javascript - 如何管理 QWEB 报告中的空间

python - 如何管理 Pandas 中的重复行

php - 我想通过代码在 Prestashop 上添加 x 个客户,但有额外的字段

xml - 在 XQuery 中声明默认元素命名空间时抛出 "Expecting expression"异常

java - 如何在Android上的所有 fragment 中保留对Web服务的身份验证?

odoo - 从 onchange 返回时,错误 : [_. sprintf] 期望数字但找到字符串