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:
@@ -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
@@ -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
|
||||
|
||||
#----------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user