[FIX] raise an exception on case.email only if need to remind partner
authorThibault Francois <tfr@openerp.com>
Wed, 2 Mar 2011 12:29:07 +0000 (13:29 +0100)
committerThibault Francois <tfr@openerp.com>
Wed, 2 Mar 2011 12:29:07 +0000 (13:29 +0100)
bzr revid: tfr@openerp.com-20110302122907-ex23dr1jzuuyjghs

addons/crm/crm.py

index e566d11..4be1297 100644 (file)
@@ -441,7 +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)
 
@@ -456,15 +456,15 @@ class crm_case(object):
         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 not destination and not case.email_from:
                 raise osv.except_osv(_('Error!'), ("Partner Email is not specified in Case"))
             if not case.user_id.user_email:
                raise osv.except_osv(_('Error!'), ("User Email is not specified in Case"))
             if case.section_id.user_id:
-                    case_email = case.section_id.user_id.user_email
+                case_email = case.section_id.user_id.user_email
             else:
-                 case_email = case.user_id.user_email       
-                                    
+                case_email = case.user_id.user_email
+
             if case.section_id.reply_to and case_email:
                 src = case_email
                 dest = case.section_id.reply_to