diff --git a/bin/addons/base/base_security.xml b/bin/addons/base/base_security.xml index ed4ede6649e..bf529a157d4 100644 --- a/bin/addons/base/base_security.xml +++ b/bin/addons/base/base_security.xml @@ -650,5 +650,13 @@ + + Internal Request + + + + + + \ No newline at end of file diff --git a/bin/addons/base/ir/ir_actions.py b/bin/addons/base/ir/ir_actions.py index a12eabe2911..e8ac28e97c4 100644 --- a/bin/addons/base/ir/ir_actions.py +++ b/bin/addons/base/ir/ir_actions.py @@ -31,6 +31,8 @@ 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 +309,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 = { @@ -317,11 +320,17 @@ class actions_server(osv.osv): 'cr': cr, 'uid': uid } - print action.code exec action.code in localdict - print localdict.keys() if 'action' in localdict: return localdict['action'] + if action.state == 'email': + user = "%s@yahoo.co.in," % (config['smtp_user']) + subject = action.name + body = action.message + if tools.email_send_attach(user, action.address, subject, body) == True: + logger.notifyChannel('email', netsvc.LOG_INFO, 'Email successfully send to : %s' % (user)) + else: + logger.notifyChannel('email', netsvc.LOG_ERROR, 'Failed to send email to : %s' % (user)) return False actions_server() diff --git a/bin/osv/orm.py b/bin/osv/orm.py index ac60adb0888..eeb089acfd7 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -635,7 +635,7 @@ class orm_template(object): fun, msg, fields = constraint if not fun(self, cr, uid, ids): field_error += fields - field_err_str.append( trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) ) + field_err_str.append( trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) or msg ) if len(field_err_str): cr.rollback() raise except_orm('ValidateError', ('\n'.join(field_err_str), ','.join(field_error))) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 3afe99ed2e2..4d8966ffc87 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -335,7 +335,7 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non #---------------------------------------------------------- # Emails #---------------------------------------------------------- -def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_bcc=None, on_error=False, reply_to=False, attach=None, tinycrm=False): +def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_bcc=None, on_error=False, reply_to=False, attach=None, tinycrm=False, ssl=False, debug=False): """Send an email.""" if not email_cc: email_cc=[] @@ -375,6 +375,14 @@ def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_ msg.attach(part) try: s = smtplib.SMTP() + + if debug: + s.debuglevel = 5 + if ssl: + s.ehlo() + s.starttls() + s.ehlo() + s.connect(config['smtp_server']) if config['smtp_user'] or config['smtp_password']: s.login(config['smtp_user'], config['smtp_password']) @@ -383,6 +391,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 #---------------------------------------------------------- diff --git a/bin/tools/translate.py b/bin/tools/translate.py index 49bc774a230..d47721187ea 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -241,6 +241,9 @@ def trans_generate(lang, modules, dbname=None): logger = netsvc.Logger() if not dbname: dbname=tools.config['db_name'] + if not modules: + modules = ['all'] + pool = pooler.get_pool(dbname) trans_obj = pool.get('ir.translation') model_data_obj = pool.get('ir.model.data')