← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 788118] Re: Bug in binary_image_get_image when no image in the field

 

Hello Serge,

I have checked your issue and trace at my end But I am not agree with
you.

Because in python in binary field when the value is false then it
doesn't goes in to if condition.

So no need to add if res and res != 'False' this because the if
condition is if res:, and the res =
proxy.default_get([field]).get(field,'') so the res comes from the
binary field that's why when the image is blank then the if condition
will not execute So no need to add if res and res != 'False' because it
doesn't make sense.

I am not consider this as a bug So I am closing this issue.
Correct me I am wrong,

Thanks.

** Changed in: openobject-client-web
       Status: New => Invalid

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/788118

Title:
  Bug in binary_image_get_image when no image in the field

Status in OpenERP Web Client:
  Invalid

Bug description:
  This error never show, bug that grow the error log very fast because
  we use many image field.

  web/addons/openerp/controllers/form.py

  def binary_image_get_image(self, **kw):
          model = kw.get('model')
          field = kw.get('field')
          id = kw.get('id')
          proxy = rpc.RPCProxy(model)
          if id == 'None':
              # FIXME: doesnt honor the context
              res = proxy.default_get([field]).get(field,'')
          else:
              res = proxy.read([int(id)], [field])[0].get(field)
          if res:
              return base64.decodestring(res)
          else:
              return open(openobject.paths.addons('openerp','static','images','placeholder.png'),'rb').read()

  When field is null, res = u'False' , so it's True ...  to patch the
  problem add  "if res and res != 'False'"

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-client-web/+bug/788118/+subscriptions


References