_# jeffery # focus on Odoo and other open source IT solutions # IT基础架构资深专家,开源解决方案专家,odoo资深专家__Q:913547235 讨论群397750860

odoo图片显示

   

如果在odoo客户端展示图片, 可以用 url( data:image/png;base64, 图片base64编码过的内容) 展示, 例如

   

url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC

   

   

如果在 其他地方以 http 形式调用, 可以 直接 使用 /web/image/图片id 方式, 例如

url('/web/image', {model: model, field: field, id: id, unique: unique} )

   

/web/image 接口支持多个参数, 直接传 图片id 最简单..

   

   

Kanban 封装了方法 _getImageURL(model, field, id, cache, options) 同时覆盖了 上面 的 2 种情况, 例如

<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar pull-right"/>

   

   

   

posted on 2018-01-01 20:12  odoouse  阅读(1898)  评论(0编辑  收藏  举报

导航

_# jeffery # focus on Odoo and other open source IT solutions # IT基础架构资深专家,开源解决方案专家,odoo资深专家