summaryrefslogtreecommitdiff
path: root/addons/project_issue
diff options
context:
space:
mode:
Diffstat (limited to 'addons/project_issue')
-rw-r--r--addons/project_issue/__init__.py1
-rw-r--r--addons/project_issue/project_issue.py87
-rw-r--r--addons/project_issue/project_issue_view.xml39
-rw-r--r--addons/project_issue/report/project_issue_report.py3
-rw-r--r--addons/project_issue/security/ir.model.access.csv4
5 files changed, 48 insertions, 86 deletions
diff --git a/addons/project_issue/__init__.py b/addons/project_issue/__init__.py
index 21efa34f6f4..f519698a60c 100644
--- a/addons/project_issue/__init__.py
+++ b/addons/project_issue/__init__.py
@@ -22,6 +22,5 @@
import project_issue
import report
-import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index 61a45f01753..8237159af7a 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -26,7 +26,9 @@ from tools.translate import _
import binascii
import time
import tools
+from crm import wizard
+wizard.mail_compose_message.SUPPORTED_MODELS.append('project.issue')
class project_issue_version(osv.osv):
_name = "project.issue.version"
@@ -44,8 +46,8 @@ class project_issue(crm.crm_case, osv.osv):
_name = "project.issue"
_description = "Project Issue"
_order = "priority, create_date desc"
- _inherit = ['mailgate.thread']
-
+ _inherit = ['mail.thread']
+
def case_open(self, cr, uid, ids, *args):
"""
@param self: The object pointer
@@ -156,7 +158,7 @@ class project_issue(crm.crm_case, osv.osv):
issues = []
issue_pool = self.pool.get('project.issue')
for task in self.pool.get('project.task').browse(cr, uid, ids, context=context):
- issues += issue_pool.search(cr, uid, [('task_id','=',task.id)])
+ issues += issue_pool.search(cr, uid, [('task_id','=',task.id)])
return issues
def _get_issue_work(self, cr, uid, ids, context=None):
@@ -174,8 +176,8 @@ class project_issue(crm.crm_case, osv.osv):
progress = 0.0
if issue.task_id:
progress = task_pool._hours_get(cr, uid, [issue.task_id.id], field_names, args, context=context)[issue.task_id.id]['progress']
- res[issue.id] = {'progress' : progress}
- return res
+ res[issue.id] = {'progress' : progress}
+ return res
_columns = {
'id': fields.integer('ID'),
@@ -225,7 +227,7 @@ class project_issue(crm.crm_case, osv.osv):
multi='compute_day', type="float", store=True),
'inactivity_days': fields.function(_compute_day, string='Days since last action', \
multi='compute_day', type="integer", help="Difference in days between last action and current date"),
- 'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
+ 'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
'progress': fields.function(_hours_get, string='Progress (%)', multi='hours', group_operator="avg", help="Computed as: Time Spent / Total Time.",
@@ -384,26 +386,17 @@ class project_issue(crm.crm_case, osv.osv):
else:
raise osv.except_osv(_('Warning !'), _('You cannot escalate this issue.\nThe relevant Project has not configured the Escalation Project!'))
self.write(cr, uid, [case.id], data)
- self._history(cr, uid, cases, _('Escalate'))
+ self.message_append(cr, uid, cases, _('Escalate'))
return True
- def message_new(self, cr, uid, msg, context=None):
- """
- Automatically calls when new email message arrives
-
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks
- """
- if context is None:
+ def message_new(self, cr, uid, msg, custom_values=None, context=None):
+ """Automatically called when new email message arrives"""
+ if context is None:
context = {}
- mailgate_pool = self.pool.get('email.server.tools')
-
subject = msg.get('subject') or _('No Title')
- body = msg.get('body')
+ body = msg.get('body_text')
msg_from = msg.get('from')
priority = msg.get('priority')
-
vals = {
'name': subject,
'email_from': msg_from,
@@ -411,37 +404,20 @@ class project_issue(crm.crm_case, osv.osv):
'description': body,
'user_id': False,
}
- if msg.get('priority', False):
+ if priority:
vals['priority'] = priority
-
- res = mailgate_pool.get_partner(cr, uid, msg.get('from'))
- if res:
- vals.update(res)
+ vals.update(self.message_partner_by_email(cr, uid, msg_from))
context.update({'state_to' : 'draft'})
- res = self.create(cr, uid, vals, context=context)
- self.convert_to_bug(cr, uid, [res], context=context)
-
- attachents = msg.get('attachments', [])
- for attactment in attachents or []:
- data_attach = {
- 'name': attactment,
- 'datas': binascii.b2a_base64(str(attachents.get(attactment))),
- 'datas_fname': attactment,
- 'description': 'Mail attachment',
- 'res_model': self._name,
- 'res_id': res,
- }
- self.pool.get('ir.attachment').create(cr, uid, data_attach)
- return res
+ if custom_values and isinstance(custom_values, dict):
+ vals.update(custom_values)
- def message_update(self, cr, uid, ids, vals=None, msg="", default_act='pending', context=None):
- """
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of update mail’s IDs
- """
+ res_id = self.create(cr, uid, vals, context)
+ self.message_append_dict(cr, uid, [res_id], msg, context=context)
+ self.convert_to_bug(cr, uid, [res_id], context=context)
+ return res_id
+
+ def message_update(self, cr, uid, ids, msg, vals=None, default_act='pending', context=None):
if vals is None:
vals = {}
@@ -450,7 +426,7 @@ class project_issue(crm.crm_case, osv.osv):
ids = [ids]
vals.update({
- 'description': msg['body']
+ 'description': msg['body_text']
})
if msg.get('priority', False):
vals['priority'] = msg.get('priority')
@@ -467,7 +443,7 @@ class project_issue(crm.crm_case, osv.osv):
record.write({'state' : 'open'})
vls = { }
- for line in msg['body'].split('\n'):
+ for line in msg['body_text'].split('\n'):
line = line.strip()
res = tools.misc.command_re.match(line)
if res and maps.get(res.group(1).lower(), False):
@@ -476,20 +452,9 @@ class project_issue(crm.crm_case, osv.osv):
vals.update(vls)
res = self.write(cr, uid, ids, vals)
+ self.message_append_dict(cr, uid, ids, msg, context=context)
return res
- def msg_send(self, cr, uid, id, *args, **argv):
-
- """ Send The Message
- @param self: The object pointer
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of email’s IDs
- @param *args: Return Tuple Value
- @param **args: Return Dictionary of Keyword Value
- """
- return True
-
def copy(self, cr, uid, id, default=None, context=None):
issue = self.read(cr, uid, id, ['name'], context=context)
if not default:
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index 1154579960e..0bf171d6aeb 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -97,15 +97,15 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="Global CC" widget="url"/>
</group>
- <field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
+ <field name="message_ids" colspan="4" nolabel="1" mode="tree,form" readonly="1">
<tree string="History">
<field name="display_text" string="History Information"/>
- <field name="history" invisible="1"/>
- <button
- string="Reply" attrs="{'invisible': [('history', '!=', True)]}"
- name="%(crm.action_crm_send_mail)d"
- context="{'mail':'reply', 'model': 'project.issue', 'include_original' : True}"
- icon="terp-mail-replied" type="action" />
+ <field name="email_from" invisible="1"/>
+ <button
+ string="Reply" attrs="{'invisible': [('email_from', '=', False)]}"
+ name="%(mail.action_email_compose_message_wizard)d"
+ context="{'mail.compose.message.mode':'reply', 'message_id':active_id}"
+ icon="terp-mail-replied" type="action" />
</tree>
<form string="History">
<group col="4" colspan="4">
@@ -113,20 +113,18 @@
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
- <field name="name" colspan="4" widget="char" size="512"/>
- <field name="history" invisible="1"/>
+ <field name="subject" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
- <group attrs="{'invisible': [('history', '!=', True)]}">
- <field name="description" colspan="4" nolabel="1" height="250"/>
- <button colspan="4"
- string="Reply"
- name="%(crm.action_crm_send_mail)d"
- context="{'mail':'reply', 'model': 'project.issue', 'include_original' : True}"
- icon="terp-mail-replied" type="action" />
+ <group attrs="{'invisible': [('email_from', '=', False)]}">
+ <field name="body_text" colspan="4" nolabel="1" height="250"/>
+ <button colspan="4" string="Reply"
+ name="%(mail.action_email_compose_message_wizard)d"
+ context="{'mail.compose.message.mode':'reply', 'message_id':active_id}"
+ icon="terp-mail-replied" type="action"/>
</group>
- <group attrs="{'invisible': [('history', '=', True)]}">
+ <group attrs="{'invisible': [('email_from', '!=', False)]}">
<field name="display_text" colspan="4" nolabel="1" height="250"/>
</group>
</page>
@@ -141,10 +139,9 @@
name="%(crm.action_crm_add_note)d"
context="{'model': 'crm.lead' }"
icon="terp-document-new" type="action" />
- <button string="Send New Email"
- name="%(crm.action_crm_send_mail)d"
- context="{'mail':'new', 'model': 'project.issue'}"
- icon="terp-mail-message-new" type="action" />
+ <button string="Send New Email"
+ name="%(mail.action_email_compose_message_wizard)d"
+ icon="terp-mail-message-new" type="action"/>
</page>
<page string="Extra Info" groups="base.group_extended">
<group col="2" colspan="2">
diff --git a/addons/project_issue/report/project_issue_report.py b/addons/project_issue/report/project_issue_report.py
index 5eae252f446..8ab987806ec 100644
--- a/addons/project_issue/report/project_issue_report.py
+++ b/addons/project_issue/report/project_issue_report.py
@@ -102,7 +102,8 @@ class project_issue_report(osv.osv):
date_trunc('day',c.create_date) as create_date,
extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open,
extract('epoch' from (c.date_closed-c.date_open))/(3600*24) as delay_close,
- (SELECT count(id) FROM mailgate_message WHERE model='project.issue' AND res_id=c.id) AS email
+ (SELECT count(id) FROM mail_message WHERE model='project.issue' AND res_id=c.id) AS email
+
FROM
project_issue c
WHERE c.categ_id IN (select id from crm_case_categ where object_id in (select id from ir_model where model = 'project.issue'))
diff --git a/addons/project_issue/security/ir.model.access.csv b/addons/project_issue/security/ir.model.access.csv
index 177533462a0..01afcb73b09 100644
--- a/addons/project_issue/security/ir.model.access.csv
+++ b/addons/project_issue/security/ir.model.access.csv
@@ -5,7 +5,7 @@
"access_crm_case_categ_id","crm.case.categ","crm.model_crm_case_categ","project.group_project_manager",1,1,1,1
"access_project_issue_version_project","project_issue_version manager","model_project_issue_version","project.group_project_manager",1,1,1,1
"access_project_issue_version_project_user","project_issue_version user","model_project_issue_version","project.group_project_user",1,0,0,0
-"access_mailgate_message_project_manager","mailgate.message.manager","mail_gateway.model_mailgate_message","project.group_project_manager",1,1,1,1
+"access_mail_message_project_manager","mail.message.manager","mail.model_mail_message","project.group_project_manager",1,1,1,1
"access_resource_calendar_project_manager","resource.calendar.project.manager","resource.model_resource_calendar","project.group_project_manager",1,1,1,1
"access_project_issue_report_user","project.issue.report user","model_project_issue_report","project.group_project_user",1,0,0,0
-"access_mailgate_message_issue_project_user","project.mailgate.message.issue.user","mail_gateway.model_mailgate_message","project.group_project_user",1,1,1,0
+"access_mail_message_issue_project_user","mail.message.user","mail.model_mail_message","project.group_project_user",1,1,1,0