Error saving changes to document in Knowledge area

Bug #752787 reported by Russell Briggs on 2011-04-06
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Web Client
Low
OpenERP R&D Web Team

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

Related branches

Russell Briggs (russell-briggs) wrote :
DBR (OpenERP) (dbr-openerp) wrote :

Hello Russell,

I am able to reproduced the same problem without following the first steps.
So, I am confirming this issue.

Thanks for reporting.

Changed in openobject-client-web:
assignee: nobody → OpenERP SA's Web Client R&D (openerp-dev-web)
importance: Undecided → Low
status: New → Confirmed
summary: - [6.0.2] Error saving changes to document in Knowledge area
+ Error saving changes to document in Knowledge area
Sananaz (Open ERP) (sma-tiny) wrote :

Hello Russell,

The fix for web-client has been committed to lp:~openerp-dev/openobject-client-web/6.0-opw-6217-sma
with the following revision.

Revision-info:
4647 <email address hidden>

Soon it will be merged into stable web-client.

Thanks for reporting and co-operation.

Changed in openobject-client-web:
status: Confirmed → In Progress
status: In Progress → Fix Committed
Navrang Oza (noz-tiny) on 2011-06-30
Changed in openobject-client-web:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers