diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index 133a47563a8..a015ef81418 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -222,39 +222,41 @@ class email_template(osv.osv):
'template_language' : lambda *a:'mako',
}
+
_sql_constraints = [
('name', 'unique (name)', _('The template name must be unique !'))
]
- def create(self, cr, uid, vals, context=None):
- id = super(email_template, self).create(cr, uid, vals, context)
- src_obj = self.pool.get('ir.model').read(cr, uid, vals['object_name'], ['model'], context)['model']
+ def create_action(self, cr, uid, ids, context):
+ vals = {}
+ template_obj = self.browse(cr, uid, ids)[0]
+ src_obj = template_obj.object_name.model
vals['ref_ir_act_window'] = self.pool.get('ir.actions.act_window').create(cr, uid, {
- 'name': _("%s Mail Form") % vals['name'],
+ 'name': _("%s Mail Form") % template_obj.name,
'type': 'ir.actions.act_window',
'res_model': 'email_template.send.wizard',
'src_model': src_obj,
'view_type': 'form',
- 'context': "{'src_model':'%s','template_id':'%d','src_rec_id':active_id,'src_rec_ids':active_ids}" % (src_obj, id),
+ 'context': "{'src_model':'%s','template_id':'%d','src_rec_id':active_id,'src_rec_ids':active_ids}" % (src_obj, template_obj.id),
'view_mode':'form,tree',
'view_id': self.pool.get('ir.ui.view').search(cr, uid, [('name', '=', 'email_template.send.wizard.form')], context=context)[0],
'target': 'new',
'auto_refresh':1
}, context)
vals['ref_ir_value'] = self.pool.get('ir.values').create(cr, uid, {
- 'name': _('Send Mail (%s)') % vals['name'],
+ 'name': _('Send Mail (%s)') % template_obj.name,
'model': src_obj,
'key2': 'client_action_multi',
'value': "ir.actions.act_window," + str(vals['ref_ir_act_window']),
'object': True,
}, context)
- self.write(cr, uid, id, {
+ self.write(cr, uid, ids, {
'ref_ir_act_window': vals['ref_ir_act_window'],
'ref_ir_value': vals['ref_ir_value'],
}, context)
- return id
+ return True
- def unlink(self, cr, uid, ids, context=None):
+ def unlink_action(self, cr, uid, ids, context):
for template in self.browse(cr, uid, ids, context):
obj = self.pool.get(template.object_name.model)
try:
@@ -264,6 +266,13 @@ class email_template(osv.osv):
self.pool.get('ir.values').unlink(cr, uid, template.ref_ir_value.id, context)
except:
raise osv.except_osv(_("Warning"), _("Deletion of Record failed"))
+
+ def delete_action(self, cr, uid, ids, context):
+ self.unlink_action(cr, uid, ids, context)
+ return True
+
+ def unlink(self, cr, uid, ids, context=None):
+ self.unlink_action(cr, uid, ids, context)
return super(email_template, self).unlink(cr, uid, ids, context)
def copy(self, cr, uid, id, default=None, context=None):
diff --git a/addons/email_template/email_template_mailbox.py b/addons/email_template/email_template_mailbox.py
index b89a9aeda26..b20fa9f76bf 100644
--- a/addons/email_template/email_template_mailbox.py
+++ b/addons/email_template/email_template_mailbox.py
@@ -41,6 +41,7 @@ class email_template_mailbox(osv.osv):
return True
def send_this_mail(self, cr, uid, ids=None, context=None):
+ result = True
for id in (ids or []):
try:
account_obj = self.pool.get('email_template.account')
diff --git a/addons/email_template/email_template_view.xml b/addons/email_template/email_template_view.xml
index 1d574ff8675..c6eb3757604 100644
--- a/addons/email_template/email_template_view.xml
+++ b/addons/email_template/email_template_view.xml
@@ -114,6 +114,10 @@
+
+
+
+
diff --git a/addons/marketing_campaign/marketing_campaign.py b/addons/marketing_campaign/marketing_campaign.py
index 386e5639dd7..efe2cde460f 100644
--- a/addons/marketing_campaign/marketing_campaign.py
+++ b/addons/marketing_campaign/marketing_campaign.py
@@ -289,7 +289,9 @@ class marketing_campaign_activity(osv.osv):
context = {}
server_obj = self.pool.get('ir.actions.server')
context['active_id'] = workitem.res_id
- return server_obj.run(cr, uid, [activity.server_action_id.id], context)
+ res = server_obj.run(cr, uid, [activity.server_action_id.id], context)
+ #server action return False if the action is perfomed except client_action,other and python code
+ return res==False and True or res
def process(self, cr, uid, act_id, wi_id, context={}):
activity = self.browse(cr, uid, act_id)
diff --git a/addons/marketing_campaign/marketing_campaign_view.xml b/addons/marketing_campaign/marketing_campaign_view.xml
index 62cb4a9cf50..bb186b65f92 100644
--- a/addons/marketing_campaign/marketing_campaign_view.xml
+++ b/addons/marketing_campaign/marketing_campaign_view.xml
@@ -2,6 +2,8 @@
+
+