UnicodeEncodeError when merging pickings with special characters

Bug #1075527 reported by Rolf Wojtech
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
BREMSKERL OpenObject Addons
Fix Released
Medium
Marco Dieckhoff

Bug Description

When trying to merge two pickings that have the character ü in the Notes, the following error is thrown.

Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/wsgi/core.py", line 79, in xmlrpc_return
    result = openerp.netsvc.dispatch_rpc(service, method, params)
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 360, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 586, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 121, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 164, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/addons/stock_merge_picking/wizard/merge_picking.py", line 222, in do_merge
    linenote += ", Notes: " + str(merge.note)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 16: ordinal not in range(128)

Apparently merge.note is in unicode, the conversion to ascii fails when it meets the non-ascii character ü.

My fix was to use tools.ustr instead of str(), see the attached patch for the wizzard. I am sure other parts of the addon are affected but unfortunately I do not have the time to look into it in depth.

I also saw that stock_merge_pickings has been deprecated, nonetheless I figured you might want to include that in your test cases. Do you have any idea if the replacement stock_picking_groups is ready for production use and if it could run in OpenERP 6.1.x?

Revision history for this message
Rolf Wojtech (rolf-wojtech) wrote :
Marco Dieckhoff (dieck)
Changed in bremskerl-addons:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Marco Dieckhoff (dieck)
Revision history for this message
Marco Dieckhoff (dieck) wrote :

Fix is released. Thank you for your contribution.

Changed in bremskerl-addons:
status: Confirmed → Fix Released
Revision history for this message
Marco Dieckhoff (dieck) wrote :

To your other question: We use stock_picking_groups in production on 6.0. (hence the branch name /6.0 :))
As we don't have 6.1 in use, I can't verify it there.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.