← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 752787] [NEW] [6.0.2] Error saving changes to document in Knowledge area

 

Public bug reported:

This actually applies to any screen where you are Editing a record that
has a Binary field on it.

To replicate:

1. FIRSTLY - if you are running the web client from source, DELETE the
following two folders:

openerp-client-web/addons/openerp/validators

openerp-client-web/openobject/validators

On my system, these folders had some .pyc files left in them, which
python was prioritising over the 'validators.py' file which was present
in the same folder. This lead to much confusion trying to isolate the
problem!!

2. In the web client, click the Knowledge button

3. Under 'Documents' on the left hand menu, select 'Documents'

4. If you do not have any 'Binary' documents, create one.

5. Click Edit on the document, do not change anything, then click
'Save'. You should get the following stack trace, generated on the
server:

Traceback (most recent call last):
  File "/usr/local/bin/openerp6/server/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/local/bin/openerp6/server/bin/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/local/bin/openerp6/server/bin/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/local/bin/openerp6/server/bin/addons/crm_simple/ir_attachment.py", line 42, in write
    return super(ir_attachment, self).write(cr, uid, ids, vals, context)
  File "/usr/local/bin/openerp6/server/bin/addons/document/document.py", line 230, in write
    result = super(document_file,self).write(cr, uid, ids, vals, context=context)
  File "/usr/local/bin/openerp6/server/bin/addons/base/ir/ir_attachment.py", line 83, in write
    return super(ir_attachment, self).write(cr, uid, ids, vals, context)
  File "/usr/local/bin/openerp6/server/bin/osv/orm.py", line 3395, in write
    result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
  File "/usr/local/bin/openerp6/server/bin/osv/fields.py", line 830, in set
    self._fnct_inv(obj, cr, user, id, name, value, self._fnct_inv_arg, context)
  File "/usr/local/bin/openerp6/server/bin/addons/document/document.py", line 101, in _data_set
    res = fnode.set_data(cr, base64.decodestring(value), fbro)
  File "/usr/lib/python2.6/base64.py", line 321, in decodestring
    return binascii.a2b_base64(s)

The cause is that the web client is sending back the value in the File
Content textbox (in my case, the string "190.81 Kb"), instead of the
newly submitted file data.

This issue was introduced in web client 6.0 revision 3369.

I attach a patch which resolves the issue

** Affects: openobject-client-web
     Importance: Undecided
         Status: New

-- 
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/752787

Title:
  [6.0.2] Error saving changes to document in Knowledge area

Status in OpenERP Web Client:
  New

Bug description:
  This actually applies to any screen where you are Editing a record
  that has a Binary field on it.

  To replicate:

  1. FIRSTLY - if you are running the web client from source, DELETE the
  following two folders:

  openerp-client-web/addons/openerp/validators

  openerp-client-web/openobject/validators

  On my system, these folders had some .pyc files left in them, which
  python was prioritising over the 'validators.py' file which was
  present in the same folder. This lead to much confusion trying to
  isolate the problem!!

  2. In the web client, click the Knowledge button

  3. Under 'Documents' on the left hand menu, select 'Documents'

  4. If you do not have any 'Binary' documents, create one.

  5. Click Edit on the document, do not change anything, then click
  'Save'. You should get the following stack trace, generated on the
  server:

  Traceback (most recent call last):
    File "/usr/local/bin/openerp6/server/bin/osv/osv.py", line 122, in wrapper
      return f(self, dbname, *args, **kwargs)
    File "/usr/local/bin/openerp6/server/bin/osv/osv.py", line 176, in execute
      res = self.execute_cr(cr, uid, obj, method, *args, **kw)
    File "/usr/local/bin/openerp6/server/bin/osv/osv.py", line 167, in execute_cr
      return getattr(object, method)(cr, uid, *args, **kw)
    File "/usr/local/bin/openerp6/server/bin/addons/crm_simple/ir_attachment.py", line 42, in write
      return super(ir_attachment, self).write(cr, uid, ids, vals, context)
    File "/usr/local/bin/openerp6/server/bin/addons/document/document.py", line 230, in write
      result = super(document_file,self).write(cr, uid, ids, vals, context=context)
    File "/usr/local/bin/openerp6/server/bin/addons/base/ir/ir_attachment.py", line 83, in write
      return super(ir_attachment, self).write(cr, uid, ids, vals, context)
    File "/usr/local/bin/openerp6/server/bin/osv/orm.py", line 3395, in write
      result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
    File "/usr/local/bin/openerp6/server/bin/osv/fields.py", line 830, in set
      self._fnct_inv(obj, cr, user, id, name, value, self._fnct_inv_arg, context)
    File "/usr/local/bin/openerp6/server/bin/addons/document/document.py", line 101, in _data_set
      res = fnode.set_data(cr, base64.decodestring(value), fbro)
    File "/usr/lib/python2.6/base64.py", line 321, in decodestring
      return binascii.a2b_base64(s)

  The cause is that the web client is sending back the value in the File
  Content textbox (in my case, the string "190.81 Kb"), instead of the
  newly submitted file data.

  This issue was introduced in web client 6.0 revision 3369.

  I attach a patch which resolves the issue



Follow ups

References