我想将选中的客户图像添加到客户姓名的左侧,并替换fa-user图标。我试着用
<t t-if='widget.pos.get_client().image'>
<img t-att-src='widget.pos.get_client().image' alt="widget.pos.get_client()"/>
</t>使用"widget.pos.get_client().image“在pos.xml中调用图像并在model.js中声明它
get_image: function() {
return this.image;
},但映像值始终为空。
有谁知道如何获取所选的客户图像吗?
感谢您的帮助
发布于 2019-07-02 21:14:55
在JS //
screens.ActionpadWidget.include({
partner_icon_url: function(id){
return '/web/image?model=res.partner&id='+id+'&field=image_small';
},
});在XML //中继承视图和此行。
<t t-extend="ActionpadWidget">
<t t-jquery="i[class='fa fa-user']" t-operation="replace">
<div class='client-picture' style="height: 50px;width: 50px;">
<img t-att-src='widget.partner_icon_url(partner.id)' alt="Partner logo"/>
</div>
</t>
</t>https://stackoverflow.com/questions/56843723
复制相似问题