diff --git a/addons/project/project.py b/addons/project/project.py
index 76ff7c5afa0..de9f2230cb2 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -519,6 +519,26 @@ class task(osv.osv):
res['fields'][f]['string'] = res['fields'][f]['string'].replace('Hours',tm)
return res
+ def action_close(self, cr, uid, ids, context=None):
+ # This action open wizard to send email to partner or project manager after close task.
+ project_id = len(ids) and ids[0] or False
+ if not project_id: return False
+ task = self.browse(cr, uid, project_id, context=context)
+ project = task.project_id
+ res = self.do_close(cr, uid, [project_id], context=context)
+ if project.warn_manager or project.warn_customer:
+ return {
+ 'name': _('Send Email after close task'),
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'project.task.close',
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ 'nodestroy': True,
+ 'context': {'active_id': task.id}
+ }
+ return res
+
def do_close(self, cr, uid, ids, context=None):
"""
Close Task
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 1c854649535..87e15fd27b1 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -112,9 +112,9 @@
-
+
-
+
@@ -241,7 +241,7 @@
-
+
@@ -320,7 +320,7 @@
-
+
diff --git a/addons/project/wizard/project_task_close.py b/addons/project/wizard/project_task_close.py
index 99b6caef308..78ffa5a8338 100644
--- a/addons/project/wizard/project_task_close.py
+++ b/addons/project/wizard/project_task_close.py
@@ -56,24 +56,18 @@ class project_task_close(osv.osv_memory):
partner = task.partner_id or task.project_id.partner_id
if 'description' in fields:
- res.update({'description': task.description})
+ res.update({'description': task.description or False})
if 'manager_warn' in fields:
- res.update({'manager_warn': project.warn_manager})
+ res.update({'manager_warn': project.warn_manager or False})
if 'partner_warn' in fields:
- res.update({'partner_warn': project.warn_customer})
+ res.update({'partner_warn': project.warn_customer or False})
if 'manager_email' in fields:
res.update({'manager_email': manager and manager.user_email or False})
if partner and len(partner.address) and 'partner_email' in fields:
res.update({'partner_email': partner.address[0].email})
return res
- def done(self, cr, uid, ids, context=None):
- task_pool = self.pool.get('project.task')
- task_id = context.get('active_id', False)
- res = task_pool.do_close(cr, uid, [task_id], context=context)
- return res
-
- def confirm(self, cr, uid, ids, context=None):
+ def send(self, cr, uid, ids, context=None):
if context is None:
context = {}
@@ -83,7 +77,6 @@ class project_task_close(osv.osv_memory):
return {}
task = task_pool.browse(cr, uid, task_id, context=context)
for data in self.browse(cr, uid, ids, context=context):
- res = task_pool.do_close(cr, uid, [task.id], context=context)
if res:
# Send Warn Message by Email to Manager and Customer
if data.manager_warn and not data.manager_email:
diff --git a/addons/project/wizard/project_task_close_view.xml b/addons/project/wizard/project_task_close_view.xml
index 4e55d7af1c9..6c064784827 100644
--- a/addons/project/wizard/project_task_close_view.xml
+++ b/addons/project/wizard/project_task_close_view.xml
@@ -3,12 +3,11 @@
- Done Task
+ Send Email
project.task.close
form
-
- Done Task
+ Send Email
ir.actions.act_window
project.task.close
form