[MERGE] [FIX] hr_recruitment: fixed message_update, broken since a few weeks

Also fixed tools.misc.command_re -> tools.command_re
Also fixed fetchmail behavior when managing replies that could lead to messages having a good parent_id, but not attached to the correct document, if headers did not hold model and res_id data.

bzr revid: tde@openerp.com-20121120090237-cekj1kzvsb772hv1
This commit is contained in:
Thibault Delavallée 2012-11-20 10:02:37 +01:00
commit 87d4e235a4
6 changed files with 14 additions and 13 deletions

View File

@ -832,7 +832,7 @@ class crm_lead(base_stage, format_address, osv.osv):
}
for line in msg.get('body', '').split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
res = tools.command_re.match(line)
if res and maps.get(res.group(1).lower()):
key = maps.get(res.group(1).lower())
update_vals[key] = res.group(2).lower()

View File

@ -224,7 +224,7 @@ class crm_claim(base_stage, osv.osv):
}
for line in msg['body'].split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
res = tools.command_re.match(line)
if res and maps.get(res.group(1).lower()):
key = maps.get(res.group(1).lower())
update_vals[key] = res.group(2).lower()

View File

@ -133,7 +133,7 @@ class crm_helpdesk(base_state, base_stage, osv.osv):
}
for line in msg['body'].split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
res = tools.command_re.match(line)
if res and maps.get(res.group(1).lower()):
key = maps.get(res.group(1).lower())
update_vals[key] = res.group(2).lower()

View File

@ -356,7 +356,8 @@ class hr_applicant(base_stage, osv.Model):
"""
if isinstance(ids, (str, int, long)):
ids = [ids]
if update_vals is None: vals = {}
if update_vals is None:
update_vals = {}
update_vals.update({
'description': msg.get('body'),
@ -373,12 +374,12 @@ class hr_applicant(base_stage, osv.Model):
}
for line in msg.get('body', '').split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
res = tools.command_re.match(line)
if res and maps.get(res.group(1).lower(), False):
key = maps.get(res.group(1).lower())
update_vals[key] = res.group(2).lower()
return super(hr_applicant, self).message_update(cr, uids, ids, update_vals=update_vals, context=context)
return super(hr_applicant, self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context)
def create(self, cr, uid, vals, context=None):
obj_id = super(hr_applicant, self).create(cr, uid, vals, context=context)
@ -420,7 +421,7 @@ class hr_applicant(base_stage, osv.Model):
self.write(cr, uid, [applicant.id], {'emp_id': emp_id}, context=context)
self.case_close(cr, uid, [applicant.id], context)
else:
raise osv.except_osv(_('Warning!'),_('You must define Applied Job for this applicant.'))
raise osv.except_osv(_('Warning!'), _('You must define Applied Job for this applicant.'))
action_model, action_id = model_data.get_object_reference(cr, uid, 'hr', 'open_view_employee_list')
dict_act_window = act_window.read(cr, uid, action_id, [])
@ -433,13 +434,13 @@ class hr_applicant(base_stage, osv.Model):
"""Overrides cancel for crm_case for setting probability
"""
res = super(hr_applicant, self).case_cancel(cr, uid, ids, context)
self.write(cr, uid, ids, {'probability' : 0.0})
self.write(cr, uid, ids, {'probability': 0.0})
return res
def case_pending(self, cr, uid, ids, context=None):
"""Marks case as pending"""
res = super(hr_applicant, self).case_pending(cr, uid, ids, context)
self.write(cr, uid, ids, {'probability' : 0.0})
self.write(cr, uid, ids, {'probability': 0.0})
return res
def case_reset(self, cr, uid, ids, context=None):
@ -452,7 +453,7 @@ class hr_applicant(base_stage, osv.Model):
def set_priority(self, cr, uid, ids, priority, *args):
"""Set applicant priority
"""
return self.write(cr, uid, ids, {'priority' : priority})
return self.write(cr, uid, ids, {'priority': priority})
def set_high_priority(self, cr, uid, ids, *args):
"""Set applicant priority to high
@ -475,7 +476,7 @@ class hr_applicant(base_stage, osv.Model):
return self.message_post(cr, uid, ids, body=_("Stage changed to <b>%s</b>.") % (stage_name), context=context)
def case_get_note_msg_prefix(self, cr, uid, id, context=None):
return 'Applicant'
return 'Applicant'
def case_open_send_note(self, cr, uid, ids, context=None):
message = _("Applicant has been set <b>in progress</b>.")

View File

@ -341,7 +341,7 @@ class mail_thread(osv.AbstractModel):
message = self.pool.get('mail.message').browse(cr, uid, message_ids[0], context=context)
_logger.debug('Routing mail with Message-Id %s: direct reply to a private message: %s, custom_values: %s, uid: %s',
message_id, message.id, custom_values, uid)
return [(False, 0, custom_values, uid)]
return [(message.model, message.res_id, custom_values, uid)]
# 2. Look for a matching mail.alias entry
# Delivered-To is a safe bet in most modern MTAs, but we have to fallback on To + Cc values

View File

@ -1247,7 +1247,7 @@ class task(base_stage, osv.osv):
}
for line in msg['body'].split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
res = tools.command_re.match(line)
if res:
match = res.group(1).lower()
field = maps.get(match)