如何在树形视图中在没有记录时显示图像?

huangapple go评论63阅读模式
英文:

How to Show image in tree view when there are no records?

问题

Sure, here's the translated code portion:

我想在树视图中显示图像,当没有记录时。这是否可能在此代码内部。

<record id="action_partner_form" model="ir.actions.act_window">
    <field name="name">Customers</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">res.partner</field>
    <field name="view_mode">kanban,tree,form</field>
    <field name="context">{'res_partner_search_mode': 'customer'}</field>
    <field name="search_view_id" ref="view_res_partner_filter"/>
    <field name="help" type="html">
        <p class="o_view_nocontent_smiling_face">
            在您的地址簿中创建联系人
        </p><p>
            Odoo可以帮助您跟踪与您的联系人相关的所有活动。
        </p>
    </field>
</record>

The HTML code you mentioned, <img src="static/description/icon.png"/>, is already in the provided code. If it's not displaying an image, you may want to check the image path and make sure it is correct and the image file is accessible at that location.

英文:

I want to show image in tree view when there are no records. Can this be possible inside this code.

<record id="action_partner_form" model="ir.actions.act_window">
            <field name="name">Customers</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.partner</field>
            <field name="view_mode">kanban,tree,form</field>
            <field name="context">{'res_partner_search_mode': 'customer'}</field>
            <field name="search_view_id" ref="view_res_partner_filter"/>
            <field name="help" type="html">
              <p class="o_view_nocontent_smiling_face">
                Create a Contact in your address book
              </p><p>
                Odoo helps you track all activities related to your contacts.
              </p>
            </field>
</record>

I tried to put <img src="static/description/icon.png"/> in help but it is showing as no image.

答案1

得分: 1

需要在src中添加模块名称,如下所示:

<img src="/base/static/description/icon.png" class="img img-fluid o_we_custom_image"/>
英文:

You need to add the module name in the src as below:

<img src="/base/static/description/icon.png" class="img img-fluid o_we_custom_image"/>

huangapple
  • 本文由 发表于 2023年5月7日 16:28:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/76192880.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定