merge
bzr revid: christophe@tinyerp.com-20080723163328-wyr58fg7gntstz1v
This commit is contained in:
@@ -650,5 +650,13 @@
|
||||
<field eval="True" name="perm_unlink"/>
|
||||
</record>
|
||||
|
||||
<record id="access_ui_menu" model="ir.model.access">
|
||||
<field name="name">Internal Request</field>
|
||||
<field model="ir.model" name="model_id" search="[('model', '=', 'res.request')]"/>
|
||||
<field eval="True" name="perm_read"/>
|
||||
<field eval="True" name="perm_write"/>
|
||||
<field eval="True" name="perm_create"/>
|
||||
<field eval="False" name="perm_unlink"/>
|
||||
</record>
|
||||
</data>
|
||||
</terp>
|
||||
@@ -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()
|
||||
|
||||
|
||||
+1
-1
@@ -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)))
|
||||
|
||||
+11
-1
@@ -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
|
||||
|
||||
#----------------------------------------------------------
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user