[6-stable] action rule crashes when name in foreign language
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned |
Bug Description
I have checked it is the same in 6.0.3.
When you use system in country using extended character set (like in Poland) you will get lead name (subjects) with national character. Fe if leads are created automatically from incoming mail.
Try to create lead manually with subject "Urządzenie - oferta" (note character "ą"), Then if you wish to trigger some server action according to this subject and subject contains national characters you will get crash error like below.
Fixing suggestion in next entry.
Environment Information :
System : Windows-32bit-SP1
OS Name : nt
Operating System Release :
Operating System Version : 32bit
Operating System Architecture : 32bit
Operating System Locale : pl_PL.cp1250
Python Version : 2.5.2
OpenERP-Client Version : 6.0.2
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call
last):
File "/usr/local/
489, in dispatch
result = ExportService.
params)
File
"/usr/local/
line 599, in dispatch
res = fn(db, uid, *params)
File "/usr/local/
122, in wrapper
return f(self, dbname, *args, **kwargs)
File "/usr/local/
176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/local/
167, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File
"/usr/local/
413, in case_pending
self.
File
"/usr/local/
524, in _action
return rule_obj.
context=context)
File
"/usr/local/
line 454, in _action
ok = self.do_check(cr, uid, action, obj, context=context)
File
"/usr/local/
line 75, in do_check
ok = super(base_
context=context)
File
"/usr/local/
line 360, in do_check
_result = ptrn.search(
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0105' in position
5: ordinal not in range(128)
I have found fix for that from bug #564486. So I tried changes in lines 359 and 360 as below and it works. At the beginning I added
from tools import ustr #gg change
359 ptrn = re.compile( ustr(reg_ name)) #gg change ustr(obj. name)) # gg change
360 _result = ptrn.search(
Please add ustr in both lines as lead subject AND regular expression should accept foreign characters.
All the best
GG.