diff options
| author | Olivier Dony <odo@openerp.com> | 2013-01-10 18:27:23 +0100 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2013-01-10 18:27:23 +0100 |
| commit | ad70edb40b4294468c5cc4f7bcd3b6d4c1b4e334 (patch) | |
| tree | 92c52af90b7c09eef21082b098ba1639bc74a7cc | |
| parent | 943453798652f3749f1b40fb9f350be743a9eac0 (diff) | |
[FIX] mail_thread subclasses: message_new must not override the explicitly provided ``custom_values``
This was the case before, but was broken involuntarily during the
big mail refactoring for v7. The default values provided by
custom message_new methods should only be used as defaults.
bzr revid: odo@openerp.com-20130110172723-ym7mcmdllcucj0j3
| -rw-r--r-- | addons/crm/crm_lead.py | 9 | ||||
| -rw-r--r-- | addons/crm_claim/crm_claim.py | 9 | ||||
| -rw-r--r-- | addons/crm_helpdesk/crm_helpdesk.py | 7 | ||||
| -rw-r--r-- | addons/hr_recruitment/hr_recruitment.py | 9 | ||||
| -rw-r--r-- | addons/project/project.py | 7 | ||||
| -rw-r--r-- | addons/project_issue/project_issue.py | 9 |
6 files changed, 28 insertions, 22 deletions
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 2fb81a005c0..ab6770aeeef 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -974,16 +974,17 @@ class crm_lead(base_stage, format_address, osv.osv): if custom_values is None: custom_values = {} desc = html2plaintext(msg.get('body')) if msg.get('body') else '' - custom_values.update({ + defaults = { 'name': msg.get('subject') or _("No Subject"), 'description': desc, 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, - }) + } if msg.get('priority') in dict(crm.AVAILABLE_PRIORITIES): - custom_values['priority'] = msg.get('priority') - return super(crm_lead, self).message_new(cr, uid, msg, custom_values=custom_values, context=context) + defaults['priority'] = msg.get('priority') + defaults.update(custom_values) + return super(crm_lead, 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 diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py index 5aaa6582e34..a724579f1e8 100644 --- a/addons/crm_claim/crm_claim.py +++ b/addons/crm_claim/crm_claim.py @@ -190,15 +190,16 @@ class crm_claim(base_stage, osv.osv): """ if custom_values is None: custom_values = {} desc = html2plaintext(msg.get('body')) if msg.get('body') else '' - custom_values.update({ + defaults = { 'name': msg.get('subject') or _("No Subject"), 'description': desc, 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), - }) + } if msg.get('priority'): - custom_values['priority'] = msg.get('priority') - return super(crm_claim,self).message_new(cr, uid, msg, custom_values=custom_values, context=context) + 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 diff --git a/addons/crm_helpdesk/crm_helpdesk.py b/addons/crm_helpdesk/crm_helpdesk.py index a707787491d..5ed1c040627 100644 --- a/addons/crm_helpdesk/crm_helpdesk.py +++ b/addons/crm_helpdesk/crm_helpdesk.py @@ -100,14 +100,15 @@ class crm_helpdesk(base_state, base_stage, osv.osv): """ if custom_values is None: custom_values = {} desc = html2plaintext(msg.get('body')) if msg.get('body') else '' - custom_values.update({ + defaults = { 'name': msg.get('subject') or _("No Subject"), 'description': desc, 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, - }) - return super(crm_helpdesk,self).message_new(cr, uid, msg, custom_values=custom_values, context=context) + } + 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 diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 33e32d94762..44d8912c5f1 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -347,16 +347,17 @@ class hr_applicant(base_stage, osv.Model): """ if custom_values is None: custom_values = {} desc = html2plaintext(msg.get('body')) if msg.get('body') else '' - custom_values.update({ + defaults = { 'name': msg.get('subject') or _("No Subject"), 'description': desc, 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, - }) + } if msg.get('priority'): - custom_values['priority'] = msg.get('priority') - return super(hr_applicant,self).message_new(cr, uid, msg, custom_values=custom_values, context=context) + 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 diff --git a/addons/project/project.py b/addons/project/project.py index 3c7c180ebb3..95f7771afce 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -1174,11 +1174,12 @@ class task(base_stage, osv.osv): 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 = {} - custom_values.update({ + defaults = { 'name': msg.get('subject'), 'planned_hours': 0.0, - }) - return super(task,self).message_new(cr, uid, msg, custom_values=custom_values, context=context) + } + defaults.update(custom_values) + 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. """ diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 5a757fdac39..7b7b6f8a3aa 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -497,17 +497,18 @@ class project_issue(base_stage, osv.osv): desc = html2plaintext(msg.get('body')) if msg.get('body') else '' - custom_values.update({ + defaults = { 'name': msg.get('subject') or _("No Subject"), 'description': desc, 'email_from': msg.get('from'), 'email_cc': msg.get('cc'), 'user_id': False, - }) + } if msg.get('priority'): - custom_values['priority'] = msg.get('priority') + defaults['priority'] = msg.get('priority') - res_id = super(project_issue, self).message_new(cr, uid, msg, custom_values=custom_values, context=context) + 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): |
