【问题标题】:OpenERP - widget image readonlyOpenERP - 小部件图像只读
【发布时间】:2015-06-16 04:46:31
【问题描述】:

我需要一个小部件图像(定义为模型中的二进制字段)的行为类似于只读字段,但事实并非如此。我在模型和视图中将该字段定义为只读,但是当进入“编辑模式”时,图像允许您上传文件,就好像它是可编辑的一样。

有没有办法解决这个问题?

提前谢谢你,

巴勃罗·卡巴洛。

【问题讨论】:

    标签: python image widget openerp readonly


    【解决方案1】:

    问题解决了!!在来自路径:/addons/web/static/src/xml/ 的文件 base.xml 中,我在标签 <t t-name="FieldBinaryImage"> 下方添加了一个 t-if 标签,用于控制在让编辑图像之前该字段是否不是只读的。

    这是包含添加行的代码块:

    <t t-name="FieldBinaryImage">
       <span class="oe_form_field oe_form_field_image" t-att-style="widget.node.attrs.style">
      <!-- the following is the line I added: -->
     <t t-if="!widget.get('effective_readonly')">
        <div class="oe_form_field_image_controls oe_edit_only">
            <t t-call="HiddenInputFile">
                <t t-set="fileupload_id" t-value="widget.fileupload_id"/>
                Edit 
            </t>
            <div class="oe_form_binary_progress" style="display: none">
                <img t-att-src='_s + "/web/static/src/img/throbber.gif"'     width="16" height="16"/>
                <b>Uploading ...</b>
            </div>
        </div>
    </t>
    </span>
    </t>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-19
      • 1970-01-01
      • 1970-01-01
      • 2020-05-29
      • 2018-10-01
      • 1970-01-01
      • 2013-04-26
      • 1970-01-01
      相关资源
      最近更新 更多