change the message, use tiny logging system for the standar message

change few things in to the email_send_attach method for the return type

bzr revid: mga@tinyerp.com-20080723081645-icvyqapkvum0py4n
This commit is contained in:
mga@tinyerp.com
2008-07-23 13:46:45 +05:30
parent 501d791ea0
commit c4b8ea7041
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -31,6 +31,7 @@ from osv import fields,osv
import tools
import time
from tools.config import config
import netsvc
class actions(osv.osv):
_name = 'ir.actions.actions'
@@ -307,6 +308,7 @@ class actions_server(osv.osv):
# False : Finnished correctly
# ACTION_ID : Action to launch
def run(self, cr, uid, ids, context={}):
logger = netsvc.Logger()
for action in self.browse(cr, uid, ids, context):
if action.state=='python':
localdict = {
@@ -325,9 +327,9 @@ class actions_server(osv.osv):
subject = action.name
body = action.message
if tools.email_send_attach(user, action.address, subject, body) == True:
print 'email send successfully'
logger.notifyChannel('email', netsvc.LOG_INFO, 'Email successfully send to : %s' % (user))
else:
print 'email sending failed'
logger.notifyChannel('email', netsvc.LOG_ERROR, 'Failed to send email to : %s' % (user))
return False
actions_server()
+2 -1
View File
@@ -359,7 +359,6 @@ def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_
if reply_to:
msg['Reply-To'] = reply_to
msg['To'] = COMMASPACE.join(email_to)
print '************', msg['To']
if email_cc:
msg['Cc'] = COMMASPACE.join(email_cc)
if email_bcc:
@@ -393,6 +392,8 @@ def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_
except Exception, e:
import logging
logging.getLogger().error(str(e))
return False
return True
#----------------------------------------------------------