如何在Odoo 9中调整图像大小?
我在models.py中创建代码,如此
image = fields.Binary("Image", default='_get_default_image',
help="This field holds the image used as avatar for this student, limited to 1024x1024px")
image_medium = fields.Binary(string="Medium-sized image", store=True, compute="_get_image", inverse='_set_image',
help="Medium-sized image of this contact. It is automatically " \
"resized as a 128x128px image, with aspect ratio preserved. " \
"Use this field in form views or some kanban views.")
@api.multi
def _get_default_image(self):
image_path = openerp.modules.get_module_resource('af', 'static/src/img', 'default_image.png')
return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64'))
@api.multi
def _get_image(self, name, args):
return dict((p.id, tools.image_get_resized_images(p.image)) for p in self)
@api.one
def _set_image(self, name, value, args):
return self.write({'image': tools.image_resize_image_big(value)})
但是,我的代码有错误
image = fields.Binary("Image", default='_get_default_image',
^
IndentationError:意外缩进