Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to get image in product module in openerp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 200
    Comment on it

    To get small image in product module first inherit the product.product object in product module and add one fields like image_small and write the fucntion _get_image in your own module in openerp.
    for example you can use the below fucntion in .py file,

    def _get_image(self, cr, uid, ids, prop, unknow_none, context=None):
            result = {}
            for obj in self.browse(cr, uid, ids, context=context):
                if not obj.product_image:
                    result[] = False
                image_stream = io.BytesIO(obj.product_image.decode('base64'))
                img =
                img.thumbnail((120, 100), Image.ANTIALIAS)
                img_stream = StringIO.StringIO()
      , "JPEG")
                result[] = img_stream.getvalue().encode('base64')
            return result

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: