improve the server action

bzr revid: mga@tinyerp.com-20081213124204-zces6hdrj9oad8r6
This commit is contained in:
Mantavya Gajjar 2008-12-13 18:12:04 +05:30
parent 98292c4dcc
commit f3f97eff55
3 changed files with 15 additions and 9 deletions

View File

@ -1196,8 +1196,8 @@
<page string="Milti Actions" attrs="{'invisible':[('state','!=','other')]}">
<separator colspan="4" string="Other Actions Configuration"/>
<field name="child_ids" nolabel="1" colspan="4" />
<label string="Only one client action will be execute, last clinent action will be consider in case of multipls clinets actions"/>
<field name="child_ids" nolabel="1" colspan="4"/>
<label colspan="4" string="Only one client action will be execute, last clinent action will be consider in case of multipls clinets actions" align="0.0"/>
</page>
</notebook>

View File

@ -431,6 +431,7 @@ class actions_server(osv.osv):
def get_email(self, cr, uid, action, context):
logger = netsvc.Logger()
obj_pool = self.pool.get(action.model_id.model)
id = context.get('active_id')
obj = obj_pool.browse(cr, uid, id)
@ -446,12 +447,13 @@ class actions_server(osv.osv):
try:
obj = getattr(obj, field)
except Exception,e :
logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (match.group()))
logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (field))
return obj
def get_mobile(self, cr, uid, action, context):
logger = netsvc.Logger()
obj_pool = self.pool.get(action.model_id.model)
id = context.get('active_id')
obj = obj_pool.browse(cr, uid, id)
@ -467,7 +469,7 @@ class actions_server(osv.osv):
try:
obj = getattr(obj, field)
except Exception,e :
logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (match.group()))
logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (field))
return obj
@ -478,10 +480,14 @@ class actions_server(osv.osv):
id = context.get('active_id')
obj = obj_pool.browse(cr, uid, id)
exp = str(match.group()[2:-2]).strip()
return eval(exp, {'object':obj, 'context': context,'time':time})
result = eval(exp, {'object':obj, 'context': context,'time':time})
if result in (None, False):
return str("--------")
return str(result)
com = re.compile('(\[\[.+?\]\])')
message = com.sub(merge, keystr)
return message
# Context should contains:
@ -522,7 +528,7 @@ class actions_server(osv.osv):
raise osv.except_osv(_('Error'), _("Please specify server option --smtp-from !"))
body = self.merge_message(cr, uid, str(action.message), action, context)
if tools.email_send(user, [address], subject, body, debug=False) == True:
if tools.email_send(user, [address], subject, body, debug=False, subtype='html') == True:
logger.notifyChannel('email', netsvc.LOG_INFO, 'Email successfully send to : %s' % (address))
else:
logger.notifyChannel('email', netsvc.LOG_ERROR, 'Failed to send email to : %s' % (address))

View File

@ -2004,7 +2004,7 @@ class orm(orm_template):
if isinstance(ids, (int, long)):
ids = [ids]
result_store = self._store_get_values(cr, user, ids, vals.keys(), context)
result_store = self._store_get_values(cr, uid, ids, None, context)
delta = context.get('read_delta', False)
if delta and self._log_access:
@ -2053,7 +2053,7 @@ class orm(orm_template):
'where id in ('+str_d+')', sub_ids)
for order, object, ids, fields in result_store:
self.pool.get(object)._store_set_values(cr, user, ids, fields, context)
self.pool.get(object)._store_set_values(cr, uid, ids, fields, context)
return True
#