您好我有一个包含3张图片的自定义课程:
class project_images(osv.osv):
_name = 'project.images'
_description = "Project Images"
def _get_image(self, cr, uid, ids, name, args, context=None):
result = dict.fromkeys(ids, False)
for obj in self.browse(cr, uid, ids, context=context):
result[obj.id] = tools.image_get_resized_images(obj.image)
return result
_columns = {
'name': fields.char('Omschrijving',help="Omschrijving/naam van de foto."),
'image_alt': fields.text('Opmerking', help="In dit veld kan meer informatie over de afbeelding gegeven worden."),
'image':fields.binary('Foto', required=True),
'image_medium':fields.function(_get_image, type="binary", multi="_get_image",string='Image Medium',
store={
'project.images': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
},
help="Small-sized image of the project. It is automatically resized as a 64x64px image, with aspect ratio preserved. Use this field anywhere a small image is required."),
'image_small':fields.function(_get_image, type="binary", multi="_get_image",string='Image Small',
store={
'project.images': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
},
help="Small-sized image of the project. It is automatically resized as a 64x64px image, with aspect ratio preserved. Use this field anywhere a small image is required."),
'project_id':fields.many2one('project.project','Project')
}
project_images()
当我想将图像添加到看板视图时,这仅适用于'image_small'字段,如下面的代码所示。
<img t-att-src="kanban_image('project.images', 'image_small', record.raw_value)" class="oe_kanban_image_inherit"/>
如果我用下面的代码替换它,它就不起作用......有什么想法吗?
<img t-att-src="kanban_image('project.images', 'image_medium', record.raw_value)" class="oe_kanban_image_inherit"/>
答案 0 :(得分:1)
您是否在外部看板上导入image_medium?请粘贴您的完整看板视图xml。