From 13b59bec4c2bff9910c759967784261ca1f3aa8e Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Wed, 23 Feb 2011 11:37:37 +0530 Subject: [PATCH] [FIX]: crm - send reminder uses wrong "from" email bzr revid: atp@tinyerp.com-20110223060737-88tydzckko1b4j8m --- addons/base_action_rule/base_action_rule.py | 1 + addons/crm/crm.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py index 2a4e2c0e4e1..e22b6869c91 100644 --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@ -398,6 +398,7 @@ the rule to mark CC(mail to any other person defined in actions)."), if hasattr(model_obj, 'remind_user') and action.act_remind_user: model_obj.remind_user(cr, uid, [obj.id], context, attach=action.act_remind_attach) if hasattr(model_obj, 'remind_partner') and action.act_remind_partner: + context.update({'remind_partner': True}) model_obj.remind_partner(cr, uid, [obj.id], context, attach=action.act_remind_attach) if action.act_method: getattr(model_obj, 'act_method')(cr, uid, [obj.id], action, context) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index f4e31575544..da216b31274 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -441,6 +441,7 @@ class crm_case(object): @param context: A standard dictionary for contextual values """ + return self.remind_user(cr, uid, ids, context, attach, destination=False) @@ -451,15 +452,19 @@ class crm_case(object): @param uid: the current user’s ID for security checks, @param ids: List of Remind user's IDs @param context: A standard dictionary for contextual values - """ for case in self.browse(cr, uid, ids, context=context): if not case.section_id.reply_to: raise osv.except_osv(_('Error!'), ("Reply To is not specified in the sales team")) - if not case.email_from: + + if context.get('remind_partner') and not case.email_from: raise osv.except_osv(_('Error!'), ("Partner Email is not specified in Case")) - if case.section_id.reply_to and case.email_from: - src = case.email_from + elif not context.get('remind_partner') and not case.user_id.user_email: + raise osv.except_osv(_('Error!'), ("User Email is not specified in Case")) + + case_email = context.get('remind_partner') and case.email_from or case.user_id.user_email + if case.section_id.reply_to and case_email: + src = case_email dest = case.section_id.reply_to body = case.description or "" if case.message_ids: