1
하이와 함께 작동 : 나는 간판보기에 이미지를 추가 할 때Odoo의 간판 이미지는 내가 3 개 이미지와 사용자 정의 클래스가 image_small
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"/>
kanban 외부에서 image_medium을 가져 왔습니까? 전체 kanban보기 xml을 붙여주세요. –
감사합니다. 당신 말이 맞아, 내가 그것을 간과했다고 믿을 수 없어. – Jesse