diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 484f628c5c0..43d0b18b0c7 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -1022,6 +1022,12 @@ Update your business card, phone book, social media,... Send an email right now through message_process. This override updates the document according to the email. """ + # remove default author when going through the mail gateway. Indeed we + # do not want to explicitly set user_id to False; however we do not + # want the gateway user to be responsible if no other responsible is + # found. + create_context = dict(context or {}) + create_context['default_user_id'] = False if custom_values is None: custom_values = {} defaults = { @@ -1029,14 +1035,13 @@ Update your business card, phone book, social media,... Send an email right now 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'partner_id': msg.get('author_id', False), - 'user_id': False, } if msg.get('author_id'): defaults.update(self.on_change_partner_id(cr, uid, None, msg.get('author_id'), context=context)['value']) if msg.get('priority') in dict(crm_stage.AVAILABLE_PRIORITIES): defaults['priority'] = msg.get('priority') defaults.update(custom_values) - return super(crm_lead, self).message_new(cr, uid, msg, custom_values=defaults, context=context) + return super(crm_lead, self).message_new(cr, uid, msg, custom_values=defaults, context=create_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 diff --git a/addons/hr_recruitment/models/hr_recruitment.py b/addons/hr_recruitment/models/hr_recruitment.py index a6cd84d0445..5d52ca247cd 100644 --- a/addons/hr_recruitment/models/hr_recruitment.py +++ b/addons/hr_recruitment/models/hr_recruitment.py @@ -392,13 +392,17 @@ class Applicant(models.Model): through message_process. This override updates the document according to the email. """ + # remove default author when going through the mail gateway. Indeed we + # do not want to explicitly set user_id to False; however we do not + # want the gateway user to be responsible if no other responsible is + # found. + self = self.with_context(default_user_id=False) val = msg.get('from').split('<')[0] defaults = { 'name': msg.get('subject') or _("No Subject"), 'partner_name': val, 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), - 'user_id': False, 'partner_id': msg.get('author_id', False), } if msg.get('priority'): diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 13eb0e14db0..f25eb43e9d9 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -394,6 +394,12 @@ class project_issue(osv.Model): through message_process. This override updates the document according to the email. """ + # remove default author when going through the mail gateway. Indeed we + # do not want to explicitly set user_id to False; however we do not + # want the gateway user to be responsible if no other responsible is + # found. + create_context = dict(context or {}) + create_context['default_user_id'] = False if custom_values is None: custom_values = {} context = dict(context or {}, state_to='draft') @@ -402,11 +408,10 @@ class project_issue(osv.Model): 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'partner_id': msg.get('author_id', False), - 'user_id': False, } defaults.update(custom_values) - res_id = super(project_issue, self).message_new(cr, uid, msg, custom_values=defaults, context=context) + res_id = super(project_issue, self).message_new(cr, uid, msg, custom_values=defaults, context=create_context) email_list = self.email_split(cr, uid, [res_id], msg, context=context) partner_ids = filter(None, self._find_partner_from_emails(cr, uid, [res_id], email_list, force_create=False, context=context)) self.message_subscribe(cr, uid, [res_id], partner_ids, context=context)