mail.thread Openerp的函数message_route中的错误

时间:2013-02-06 19:10:49

标签: message openerp

对我来说,默认行为之一(即第3次尝试获取消息路由:“回退到提供的参数,如果它们有效”).message_route(...)无法正常工作。

它应该解析主题,使用像[ID]这样的表达式作为'thread_id'来发布消息。到目前为止,非常好。

问题是在到达这一点之前,正在解析(当然).message_parse(...)中的消息,这使得当以这种方式获得'thread_id'时,我们最终会得到一个unicode-字符串而不是所需的#ID为整数或长。

我是对的还是我错过了什么?

def message_route(self, cr, uid, message, model=None, thread_id=None,
                  custom_values=None, context=None):
[...]
    3. Fallback to the ``model``, ``thread_id`` and ``custom_values``
       provided.
[...]
# 3. Fallback to the provided parameters, if they work
    if not thread_id:
         # Legacy: fallback to matching [ID] in the Subject
         match = tools.res_re.search(decode_header(message, 'Subject'))
         thread_id = match and match.group(1)
     assert thread_id and hasattr(model_pool, 'message_update') or hasattr(model_pool, 'message_new'), \
         "No possible route found for incoming message with Message-Id %s. " \
         "Create an appropriate mail.alias or force the destination model." % message_id
     if thread_id and not model_pool.exists(cr, uid, thread_id):
         _logger.warning('Received mail reply to missing document %s! Ignoring and     creating new document instead for Message-Id %s',
                         thread_id, message_id)
         thread_id = None
     _logger.debug('Routing mail with Message-Id %s: fallback to model:%s, thread_id:%s, custom_values:%s, uid:%s',
                   message_id, model, thread_id, custom_values, uid)
     return [(model, thread_id, custom_values, uid)]

0 个答案:

没有答案