through message_process.
This override updates the document according to the email.
"""
- if custom_values is None: custom_values = {}
+ if custom_values is None:
+ custom_values = {}
desc = html2plaintext(msg.get('body')) if msg.get('body') else ''
defaults = {
'name': msg.get('subject') or _("No Subject"),
if msg.get('priority'):
defaults['priority'] = msg.get('priority')
defaults.update(custom_values)
- return super(crm_claim,self).message_new(cr, uid, msg, custom_values=defaults, context=context)
-
- def message_update(self, cr, uid, ids, msg, update_vals=None, context=None):
- """ Overrides mail_thread message_update that is called by the mailgateway
- through message_process.
- This method updates the document according to the email.
- """
- if isinstance(ids, (str, int, long)):
- ids = [ids]
- if update_vals is None: update_vals = {}
-
- if msg.get('priority') in dict(crm.AVAILABLE_PRIORITIES):
- update_vals['priority'] = msg.get('priority')
-
- maps = {
- 'cost':'planned_cost',
- 'revenue': 'planned_revenue',
- 'probability':'probability'
- }
- for line in msg['body'].split('\n'):
- line = line.strip()
- 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()
-
- return super(crm_claim,self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context)
+ return super(crm_claim, self).message_new(cr, uid, msg, custom_values=defaults, context=context)
class res_partner(osv.osv):
_inherit = 'res.partner'
through message_process.
This override updates the document according to the email.
"""
- if custom_values is None: custom_values = {}
+ if custom_values is None:
+ custom_values = {}
desc = html2plaintext(msg.get('body')) if msg.get('body') else ''
defaults = {
'name': msg.get('subject') or _("No Subject"),
'partner_id': msg.get('author_id', False),
}
defaults.update(custom_values)
- return super(crm_helpdesk,self).message_new(cr, uid, msg, custom_values=defaults, context=context)
-
- def message_update(self, cr, uid, ids, msg, update_vals=None, context=None):
- """ Overrides mail_thread message_update that is called by the mailgateway
- through message_process.
- This method updates the document according to the email.
- """
- if isinstance(ids, (str, int, long)):
- ids = [ids]
- if update_vals is None: update_vals = {}
-
- if msg.get('priority') in dict(crm.AVAILABLE_PRIORITIES):
- update_vals['priority'] = msg.get('priority')
-
- maps = {
- 'cost':'planned_cost',
- 'revenue': 'planned_revenue',
- 'probability':'probability'
- }
- for line in msg['body'].split('\n'):
- line = line.strip()
- 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()
-
- return super(crm_helpdesk,self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context)
+ return super(crm_helpdesk, self).message_new(cr, uid, msg, custom_values=defaults, context=context)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
through message_process.
This override updates the document according to the email.
"""
- if custom_values is None: custom_values = {}
+ if custom_values is None:
+ custom_values = {}
desc = html2plaintext(msg.get('body')) if msg.get('body') else ''
defaults = {
'name': msg.get('subject') or _("No Subject"),
if msg.get('priority'):
defaults['priority'] = msg.get('priority')
defaults.update(custom_values)
- return super(hr_applicant,self).message_new(cr, uid, msg, custom_values=defaults, context=context)
-
- def message_update(self, cr, uid, ids, msg, update_vals=None, context=None):
- """ Override mail_thread message_update that is called by the mailgateway
- through message_process.
- This method updates the document according to the email.
- """
- if isinstance(ids, (str, int, long)):
- ids = [ids]
- if update_vals is None:
- update_vals = {}
-
- update_vals.update({
- 'email_from': msg.get('from'),
- 'email_cc': msg.get('cc'),
- })
- if msg.get('priority'):
- update_vals['priority'] = msg.get('priority')
-
- maps = {
- 'cost': 'planned_cost',
- 'revenue': 'planned_revenue',
- 'probability': 'probability',
- }
- for line in msg.get('body', '').split('\n'):
- line = line.strip()
- 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, uid, ids, msg, update_vals=update_vals, context=context)
+ return super(hr_applicant, self).message_new(cr, uid, msg, custom_values=defaults, context=context)
def create(self, cr, uid, vals, context=None):
if context is None:
def message_new(self, cr, uid, msg, custom_values=None, context=None):
""" Override to updates the document according to the email. """
- if custom_values is None: custom_values = {}
+ if custom_values is None:
+ custom_values = {}
defaults = {
'name': msg.get('subject'),
'planned_hours': 0.0,
}
defaults.update(custom_values)
- return super(task,self).message_new(cr, uid, msg, custom_values=defaults, context=context)
+ return super(task, self).message_new(cr, uid, msg, custom_values=defaults, context=context)
def message_update(self, cr, uid, ids, msg, update_vals=None, context=None):
""" Override to update the task according to the email. """
- if update_vals is None: update_vals = {}
- act = False
+ if update_vals is None:
+ update_vals = {}
maps = {
- 'cost':'planned_hours',
+ 'cost': 'planned_hours',
}
for line in msg['body'].split('\n'):
line = line.strip()
update_vals[field] = float(res.group(2).lower())
except (ValueError, TypeError):
pass
- elif match.lower() == 'state' \
- and res.group(2).lower() in ['cancel','close','draft','open','pending']:
- act = 'do_%s' % res.group(2).lower()
- if act:
- getattr(self,act)(cr, uid, ids, context=context)
- return super(task,self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context)
+ return super(task, self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context)
def project_task_reevaluate(self, cr, uid, ids, context=None):
if self.pool.get('res.users').has_group(cr, uid, 'project.group_time_work_estimation_tasks'):
through message_process.
This override updates the document according to the email.
"""
- if custom_values is None: custom_values = {}
- if context is None: context = {}
+ if custom_values is None:
+ custom_values = {}
+ if context is None:
+ context = {}
context['state_to'] = 'draft'
desc = html2plaintext(msg.get('body')) if msg.get('body') else ''
'partner_id': msg.get('author_id', False),
'user_id': False,
}
- if msg.get('priority'):
- defaults['priority'] = msg.get('priority')
-
defaults.update(custom_values)
res_id = super(project_issue, self).message_new(cr, uid, msg, custom_values=defaults, context=context)
return res_id
- def message_update(self, cr, uid, ids, msg, update_vals=None, context=None):
- """ Overrides mail_thread message_update that is called by the mailgateway
- through message_process.
- This method updates the document according to the email.
- """
- if isinstance(ids, (str, int, long)):
- ids = [ids]
- if update_vals is None: update_vals = {}
-
- # Update doc values according to the message
- if msg.get('priority'):
- update_vals['priority'] = msg.get('priority')
- # Parse 'body' to find values to update
- maps = {
- 'cost': 'planned_cost',
- 'revenue': 'planned_revenue',
- 'probability': 'probability',
- }
- for line in msg.get('body', '').split('\n'):
- line = line.strip()
- 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(project_issue, self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context)
-
def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification', subtype=None, parent_id=False, attachments=None, context=None, content_subtype='html', **kwargs):
""" Overrides mail_thread message_post so that we can set the date of last action field when
a new message is posted on the issue.