diff options
Diffstat (limited to 'addons/project_issue')
| -rw-r--r-- | addons/project_issue/project_issue.py | 67 | ||||
| -rw-r--r-- | addons/project_issue/project_issue_view.xml | 10 | ||||
| -rw-r--r-- | addons/project_issue/report/project_issue_report.py | 2 | ||||
| -rw-r--r-- | addons/project_issue/wizard/email_compose_message.py | 5 |
4 files changed, 20 insertions, 64 deletions
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 484802f8638..d799d60d5db 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -44,7 +44,7 @@ class project_issue(crm.crm_case, osv.osv): _name = "project.issue" _description = "Project Issue" _order = "priority, create_date desc" - _inherit = ['email.thread'] + _inherit = ['mail.thread'] def case_open(self, cr, uid, ids, *args): """ @@ -383,20 +383,14 @@ class project_issue(crm.crm_case, osv.osv): self.history(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 - """ + def message_new(self, cr, uid, msg, custom_values=None, context=None): + """Automatically called when new email message arrives""" if context is None: context = {} - thread_pool = self.pool.get('email.thread') + thread_pool = self.pool.get('mail.thread') 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') @@ -407,7 +401,7 @@ class project_issue(crm.crm_case, osv.osv): 'description': body, 'user_id': False, } - if msg.get('priority', False): + if priority: vals['priority'] = priority res = thread_pool.get_partner(cr, uid, msg.get('from')) @@ -415,34 +409,15 @@ class project_issue(crm.crm_case, osv.osv): vals.update(res) context.update({'state_to' : 'draft'}) - res_id = self.create(cr, uid, vals, context) + if custom_values and isinstance(custom_values, dict): + vals.update(custom_values) - attachments = msg.get('attachments', {}) - self.history(cr, uid, [res_id], _('receive'), history=True, - subject = msg.get('subject'), - email = msg.get('to'), - details = msg.get('body'), - email_from = msg.get('from'), - email_cc = msg.get('cc'), - message_id = msg.get('message-id'), - references = msg.get('references', False) or msg.get('in-reply-to', False), - attach = attachments, - email_date = msg.get('date'), - body_html= msg.get('body_html'), - sub_type = msg.get('sub_type'), - headers = msg.get('headers'), - priority = msg.get('priority'), - context = context) + res_id = self.create(cr, uid, vals, context) + self.append_mail(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): - """ - @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 - """ if vals is None: vals = {} @@ -451,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') @@ -468,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): @@ -477,23 +452,7 @@ class project_issue(crm.crm_case, osv.osv): vals.update(vls) res = self.write(cr, uid, ids, vals) - - attachments = msg.get('attachments', {}) - self.history(cr, uid, ids, _('receive'), history=True, - subject = msg.get('subject'), - email = msg.get('to'), - details = msg.get('body'), - email_from = msg.get('from'), - email_cc = msg.get('cc'), - message_id = msg.get('message-id'), - references = msg.get('references', False) or msg.get('in-reply-to', False), - attach = attachments, - email_date = msg.get('date'), - body_html= msg.get('body_html'), - sub_type = msg.get('sub_type'), - headers = msg.get('headers'), - priority = msg.get('priority'), - context = context) + self.append_mail(cr, uid, [res_id], msg, context=context) return res def copy(self, cr, uid, id, default=None, context=None): diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index b60fd4f0c6b..ffe5110e6a9 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -100,9 +100,8 @@ <field name="message_ids" colspan="4" nolabel="1" mode="tree,form"> <tree string="History"> <field name="display_text" string="History Information"/> - <field name="history" invisible="1"/> <button - string="Reply" attrs="{'invisible': [('history', '!=', True)]}" + string="Reply" attrs="{'invisible': [('email_from', '=', False)]}" name="%(mail.action_email_compose_message_wizard)d" context="{'mail':'reply', 'message_id':active_id}" icon="terp-mail-replied" type="action" /> @@ -114,18 +113,17 @@ <field name="email_to" widget="char" size="512"/> <field name="email_cc" widget="char" size="512"/> <field name="subject" colspan="4" widget="char" size="512"/> - <field name="history" invisible="1"/> </group> <notebook colspan="4"> <page string="Details"> - <group attrs="{'invisible': [('history', '!=', True)]}"> - <field name="body" colspan="4" nolabel="1" height="250"/> + <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':'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> diff --git a/addons/project_issue/report/project_issue_report.py b/addons/project_issue/report/project_issue_report.py index 6b56a254a4a..a199d1c9d57 100644 --- a/addons/project_issue/report/project_issue_report.py +++ b/addons/project_issue/report/project_issue_report.py @@ -102,7 +102,7 @@ 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 email_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 diff --git a/addons/project_issue/wizard/email_compose_message.py b/addons/project_issue/wizard/email_compose_message.py index df1133245d2..ffb708ebe35 100644 --- a/addons/project_issue/wizard/email_compose_message.py +++ b/addons/project_issue/wizard/email_compose_message.py @@ -24,7 +24,7 @@ from osv import fields import tools class email_compose_message(osv.osv_memory): - _inherit = 'email.compose.message' + _inherit = 'mail.compose.message' def get_value(self, cr, uid, model, resource_id, context=None): ''' @@ -44,13 +44,12 @@ class email_compose_message(osv.osv_memory): 'subject' : data.name or False, 'email_to' : data.email_from or False, 'email_from' : data.user_id and data.user_id.address_id and data.user_id.address_id.email or False, - 'body' : '\n' + (tools.ustr(data.user_id.signature or '')), + 'body_text' : '\n' + (tools.ustr(data.user_id.signature or '')), 'email_cc' : tools.ustr(data.email_cc or ''), 'model': model, 'res_id': resource_id, }) return result -email_compose_message() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
