mail_thread message_route misleading model
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
New
|
Undecided
|
Unassigned |
Bug Description
If default server action for incoming mail server is crm.helpdesk and message is sent with an id:
1387684209.
This will end up trying to create a new account.invoice obcject and failing with Null required values (like account_id).
After lots of messages and debugging - the problem is found.
def message_route(self, cr, uid, message, model=None, thread_id=None,
[...]
if ref_match:
model = ref_match.group(2) or model
if thread_id and model and model_pool and model_pool.
and hasattr(model_pool, 'message_update'):
[ here the ref_match returns something and local model is changed for matched model,
there is no existing thread id and this if statement does not return !
and later in the same scope of method]
# 3. Fallback to the provided parameters, if they work
model_pool = self.pool.
if not thread_id:
# Legacy: fallback to matching [ID] in the Subject
match = tools.res_
# Convert into int (bug spotted in 7.0 because of str)
try:
except:
assert thread_id and hasattr(model_pool, 'message_update') or hasattr(model_pool, 'message_new'), \
"No possible route found for incoming message from %s to %s (Message-Id %s:)." \
"Create an appropriate mail.alias or force the destination model." % (email_from, email_to, message_id)
if thread_id and not model_pool.
return [(model, thread_id, custom_values, uid)]
[ here we have not the default model 'crm.helpdesk' but account.invoice with no thread_id
so the returned route will be: [(u'account.
solution:
if ref_match:
if thread_id and model_match and model_pool and model_pool.
and hasattr(model_pool, 'message_update'):
this is openobject-addons revno: 9701