bug fix :crm.case problem empty body on mail, now it gives warning to the user

bzr revid: mra@tinyerp.com-20090204094657-dm12oc470o3681hy
This commit is contained in:
mra (Open ERP)
2009-02-04 15:16:57 +05:30
parent 0ddb162633
commit 718f80985b
+13 -10
View File
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@@ -181,7 +181,7 @@ class crm_case_section(osv.osv):
'object': True
})
return True
def name_get(self, cr, uid, ids, context={}):
if not len(ids):
return []
@@ -295,7 +295,7 @@ class crm_case_rule(osv.osv):
except (ValueError, KeyError, TypeError):
return False
return True
_constraints = [
(_check_mail, 'Error: The mail is not well formated', ['act_mail_body']),
]
@@ -505,7 +505,7 @@ class crm_case(osv.osv):
action_ids = newactions
level -= 1
return True
def format_body(self, body):
return tools.ustr(body.encode('ascii', 'replace'))
@@ -614,11 +614,11 @@ class crm_case(osv.osv):
# Send an email
tools.email_send(
src,
dest,
src,
dest,
"Reminder: [%s] %s" % (str(case.id), case.name, ),
self.format_body(body),
reply_to=case.section_id.reply_to,
reply_to=case.section_id.reply_to,
tinycrm=str(case.id),
attach=attach_to_send
)
@@ -646,6 +646,9 @@ class crm_case(osv.osv):
if not case.email_from:
raise osv.except_osv(_('Error!'),
_('You must put a Partner eMail to use this action!'))
if not case.description:
raise osv.except_osv(_('Error!'),
_('Can not send mail with empty body,you should have description in the body'))
self.__history(cr, uid, cases, _('Send'), history=True, email=False)
for case in cases:
self.write(cr, uid, [case.id], {
@@ -659,11 +662,11 @@ class crm_case(osv.osv):
if case.user_id.signature:
body += '\n\n%s' % (case.user_id.signature)
tools.email_send(
case.user_id.address_id.email,
case.user_id.address_id.email,
emails,
'['+str(case.id)+'] '+case.name,
'['+str(case.id)+'] '+case.name,
self.format_body(body),
reply_to=case.section_id.reply_to,
reply_to=case.section_id.reply_to,
tinycrm=str(case.id)
)
return True