def _get_square_image(self, cr, uid, ids, name, args, context=None): result = dict.fromkeys(ids, False) for obj in self.browse(cr, uid, ids, context=context): # need to return also an dict for the image like result[1] = {'image_square': base_64_data} result[obj.id] = {'image_square': False} if obj.image: # Get x and y size from website config # HINT: Only one Webpage allowed in odoo 8 ;) so [0] is ok website = self.pool.get('website').search(cr, uid, [], context=context)[0] website = self.pool.get('website').browse(cr, uid, website, context=context) x = website.square_image_x or 440 y = website.square_image_y or 440 result[obj.id] = { 'image_square': resize_to_thumbnail( img=obj.image, box=(x, y), ) } return result
def _get_square_image(self, cr, uid, ids, name, args, context=None): result = dict.fromkeys(ids, False) for obj in self.browse(cr, uid, ids, context=context): # need to return also an dict for the image like result[1] = {'image_square': base_64_data} result[obj.id] = {'image_square': False} if obj.image: result[obj.id] = {'image_square': resize_to_thumbnail(img=obj.image, box=(440, 440),)} return result
def _get_square_image(self, cr, uid, ids, name, args, context=None): result = dict.fromkeys(ids, False) for obj in self.browse(cr, uid, ids, context=context): # need to return also an dict for the image like result[1] = {'image_square': base_64_data} result[obj.id] = {'image_square': False} if obj.image: result[obj.id] = { 'image_square': resize_to_thumbnail( img=obj.image, box=(440, 440), ) } return result
def _get_square_image(self, cr, uid, ids, name, args, context=None): result = dict.fromkeys(ids, False) for obj in self.browse(cr, uid, ids, context=context): # need to return also an dict for the image like result[1] = {'image_square': base_64_data} result[obj.id] = {'image_square': False} if obj.image: # Get x and y size from website config # HINT: Only one Webpage allowed in odoo 8 ;) so [0] is ok website = self.pool.get('website').search(cr, uid, [], context=context)[0] website = self.pool.get('website').browse(cr, uid, website, context=context) x = website.square_image_x or 440 y = website.square_image_y or 440 result[obj.id] = {'image_square': resize_to_thumbnail(img=obj.image, box=(x, y),)} return result