[FIX] base_action_rule: Encoding trouble in mail_message parsing and base_action_rule processin

lp bug: https://launchpad.net/bugs/921442 fixed

bzr revid: kjo@tinyerp.com-20110209111537-xh7tcqqo50xfoty1
This commit is contained in:
Kuldeep Joshi (OpenERP) 2011-02-09 16:45:37 +05:30
parent 0e2e9ddd78
commit f7e4fb3192
2 changed files with 6 additions and 4 deletions

View File

@ -28,6 +28,7 @@ import pooler
import re import re
import time import time
import tools import tools
from openerp.loglevels import ustr
def get_datetime(date_field): def get_datetime(date_field):
@ -369,8 +370,8 @@ the rule to mark CC(mail to any other person defined in actions)."),
reg_name = action.regex_name reg_name = action.regex_name
result_name = True result_name = True
if reg_name: if reg_name:
ptrn = re.compile(str(reg_name)) ptrn = re.compile(ustr(reg_name))
_result = ptrn.search(str(obj.name)) _result = ptrn.search(ustr(obj.name))
if not _result: if not _result:
result_name = False result_name = False
regex_n = not reg_name or result_name regex_n = not reg_name or result_name

View File

@ -27,6 +27,7 @@ from osv import fields
from osv import osv from osv import osv
import crm import crm
from openerp.loglevels import ustr
class base_action_rule(osv.osv): class base_action_rule(osv.osv):
""" Base Action Rule """ """ Base Action Rule """
@ -73,9 +74,9 @@ class base_action_rule(osv.osv):
regex = action.regex_history regex = action.regex_history
if regex: if regex:
res = False res = False
ptrn = re.compile(str(regex)) ptrn = re.compile(ustr(regex))
for history in obj.message_ids: for history in obj.message_ids:
_result = ptrn.search(str(history.name)) _result = ptrn.search(ustr(history.subject))
if _result: if _result:
res = True res = True
break break