[IMP] mail: able to retrive priority of an email message and related changes in message_new() and message_update()
bzr revid: rha@tinyerp.com-20110503063844-yhlhlnpvciveh219
This commit is contained in:
parent
48e0f09e68
commit
3a904e407b
|
@ -170,6 +170,7 @@ class crm_lead(crm_case, osv.osv):
|
|||
\nWhen the case is over, the state is set to \'Done\'.\
|
||||
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
|
||||
'message_ids': fields.one2many('email.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
|
||||
'subjects': fields.function(_get_email_subject, fnct_search=_history_search, string='Subject of Email', method=True, type='char', size=64),
|
||||
}
|
||||
|
||||
|
||||
|
@ -381,7 +382,7 @@ class crm_lead(crm_case, osv.osv):
|
|||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority', False),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
|
||||
return res_id
|
||||
|
@ -433,6 +434,10 @@ class crm_lead(crm_case, osv.osv):
|
|||
references = msg.get('references', False) or msg.get('in-reply-to', False),
|
||||
attach = attachments,
|
||||
email_date = msg.get('date'),
|
||||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
return res
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ class crm_claim(crm.crm_case, osv.osv):
|
|||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority', False),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
|
||||
return res_id
|
||||
|
@ -270,6 +270,10 @@ class crm_claim(crm.crm_case, osv.osv):
|
|||
references = msg.get('references', False) or msg.get('in-reply-to', False),
|
||||
attach = attachments,
|
||||
email_date = msg.get('date'),
|
||||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
return res
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ class crm_helpdesk(crm.crm_case, osv.osv):
|
|||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority', False),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
|
||||
return res_id
|
||||
|
@ -193,6 +193,10 @@ class crm_helpdesk(crm.crm_case, osv.osv):
|
|||
references = msg.get('references', False) or msg.get('in-reply-to', False),
|
||||
attach = attachments,
|
||||
email_date = msg.get('date'),
|
||||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
return res
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ class hr_applicant(crm.crm_case, osv.osv):
|
|||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority', False),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
|
||||
return res_id
|
||||
|
@ -391,6 +391,10 @@ class hr_applicant(crm.crm_case, osv.osv):
|
|||
references = msg.get('references', False) or msg.get('in-reply-to', False),
|
||||
attach = attachments,
|
||||
email_date = msg.get('date'),
|
||||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
return res
|
||||
|
||||
|
|
|
@ -60,6 +60,13 @@ email_content_types = [
|
|||
('html', 'text/html')
|
||||
]
|
||||
|
||||
priorities = {
|
||||
'1 (Highest)': '1',
|
||||
'2 (High)': '2',
|
||||
'3 (Normal)': '3',
|
||||
'4 (Low)': '4',
|
||||
'5 (Lowest)': '5',
|
||||
}
|
||||
|
||||
LOGGER = netsvc.Logger()
|
||||
_logger = logging.getLogger('mail')
|
||||
|
@ -328,7 +335,6 @@ class email_message(osv.osv):
|
|||
msg_txt['message-id'] = message_id
|
||||
_logger.info('Parsing Message without message-id, generating a random one: %s', message_id)
|
||||
|
||||
|
||||
fields = msg_txt.keys()
|
||||
msg['id'] = message_id
|
||||
msg['message-id'] = message_id
|
||||
|
@ -364,7 +370,9 @@ class email_message(osv.osv):
|
|||
msg['in-reply-to'] = msg_txt.get('In-Reply-To')
|
||||
|
||||
if 'X-Priority' in fields:
|
||||
msg['priority'] = msg_txt.get('X-Priority', '3 (Normal)').split(' ')[0] #TOFIX:
|
||||
msg['priority'] = priorities[msg_txt.get('X-Priority')]
|
||||
else:
|
||||
msg['priority'] = priorities['3 (Normal)']
|
||||
|
||||
msg['headers'] = {}
|
||||
for item in msg_txt.items():
|
||||
|
|
|
@ -96,6 +96,7 @@ class email_thread(osv.osv):
|
|||
sub_type = msg.get('sub_type', False),
|
||||
headers = msg.get('headers', False),
|
||||
reply = msg.get('reply', False),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
return res_id
|
||||
|
||||
|
@ -125,6 +126,7 @@ class email_thread(osv.osv):
|
|||
sub_type = msg.get('sub_type', False),
|
||||
headers = msg.get('headers', False),
|
||||
reply = msg.get('reply', False),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
return True
|
||||
|
||||
|
@ -168,8 +170,6 @@ class email_thread(osv.osv):
|
|||
if attach is None:
|
||||
attach = {}
|
||||
|
||||
|
||||
|
||||
if email_date:
|
||||
edate = parsedate(email_date)
|
||||
if edate is not None:
|
||||
|
@ -244,7 +244,8 @@ class email_thread(osv.osv):
|
|||
'body_html': body_html,
|
||||
'sub_type': sub_type,
|
||||
'headers': headers,
|
||||
'reply_to': reply
|
||||
'reply_to': reply,
|
||||
'priority': priority
|
||||
}
|
||||
obj.create(cr, uid, data, context=context)
|
||||
return True
|
||||
|
|
|
@ -423,7 +423,7 @@ class project_issue(crm.crm_case, osv.osv):
|
|||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority', False),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
self.convert_to_bug(cr, uid, [res_id], context=context)
|
||||
return res_id
|
||||
|
@ -481,6 +481,10 @@ class project_issue(crm.crm_case, osv.osv):
|
|||
references = msg.get('references', False) or msg.get('in-reply-to', False),
|
||||
attach = attachments,
|
||||
email_date = msg.get('date'),
|
||||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
return res
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class project_tasks(osv.osv):
|
|||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority', False),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
|
||||
return res_id
|
||||
|
@ -108,6 +108,10 @@ class project_tasks(osv.osv):
|
|||
references = msg.get('references', False) or msg.get('in-reply-to', False),
|
||||
attach = attachments,
|
||||
email_date = msg.get('date'),
|
||||
body_html= msg.get('body_html'),
|
||||
sub_type = msg.get('sub_type'),
|
||||
headers = msg.get('headers'),
|
||||
priority = msg.get('priority'),
|
||||
context = context)
|
||||
return True
|
||||
|
||||
|
|
Loading…
Reference in New Issue