2017-10-03 1 views
1

Salut, j'ai une classe personnalisée avec 3 images:Odoo image Kanban fonctionne uniquement avec 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() 

Quand je veux ajouter une image à la vue kanban cela ne fonctionne qu'avec le champ « image_small » comme dans le code ci-dessous. Si je remplace cela par du code ci-dessous, ça ne marchera pas ... Des idées?

<img t-att-src="kanban_image('project.images', 'image_medium', record.raw_value)" class="oe_kanban_image_inherit"/> 
+0

avez-vous importé image_medium en dehors de kanban? s'il vous plaît collez votre kanban complet xml. –

+0

Merci! Tu as raison, je ne peux pas croire que j'ai oublié ça. – Jesse

Répondre

1

avez-vous importé image_medium en dehors de kanban? s'il vous plaît collez votre kanban complet xml.

+0

s'il vous plaît marquer cela comme réponse si vous trouvez une solution. –