summaryrefslogtreecommitdiff
path: root/addons/hr_recruitment
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2011-08-22 19:16:59 +0200
committerOlivier Dony <odo@openerp.com>2011-08-22 19:16:59 +0200
commit8f9f45ea948d1ffecb79601e860d522fc6686c2d (patch)
treea789d72a67cef289e770323aaf45c158579ecc6c /addons/hr_recruitment
parent50507512cbaf6d0119a29943c9ca85deb4057404 (diff)
[IMP] all: next pass of review/renaming for new mail API
bzr revid: odo@openerp.com-20110822171659-zxho36a6n628i10q
Diffstat (limited to 'addons/hr_recruitment')
-rw-r--r--addons/hr_recruitment/hr_recruitment.py60
-rw-r--r--addons/hr_recruitment/hr_recruitment_view.xml8
-rw-r--r--addons/hr_recruitment/wizard/email_compose_message.py5
-rw-r--r--addons/hr_recruitment/wizard/hr_recruitment_phonecall.py6
4 files changed, 18 insertions, 61 deletions
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index dd36394bf88..1113aa2fbc6 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -80,7 +80,7 @@ class hr_applicant(crm.crm_case, osv.osv):
_name = "hr.applicant"
_description = "Applicant"
_order = "id desc"
- _inherit = ['email.thread']
+ _inherit = ['mail.thread']
def _compute_day(self, cr, uid, ids, fields, args, context=None):
"""
@@ -118,7 +118,7 @@ class hr_applicant(crm.crm_case, osv.osv):
_columns = {
'name': fields.char('Name', size=128, required=True),
- 'message_ids': fields.one2many('email.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
+ 'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the case without removing it."),
'description': fields.text('Description'),
'email_from': fields.char('Email', size=128, help="These people will receive email."),
@@ -298,11 +298,11 @@ class hr_applicant(crm.crm_case, osv.osv):
value = self.pool.get("survey").action_print_survey(cr, uid, ids, context=context)
return value
- def message_new(self, cr, uid, msg, context=None):
- """Automatically calls when new email message arrives"""
+ def message_new(self, cr, uid, msg, custom_values=None, context=None):
+ """Automatically called when new email message arrives"""
thread_pool = self.pool.get('mail.thread')
subject = msg.get('subject') or _("No Subject")
- body = msg.get('body')
+ body = msg.get('body_text')
msg_from = msg.get('from')
priority = msg.get('priority')
@@ -313,47 +313,23 @@ class hr_applicant(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'))
if res:
vals.update(res)
res_id = self.create(cr, uid, vals, context)
-
- 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)
-
+ self.append_mail(cr, uid, ids, msg, context=context)
return res_id
def message_update(self, cr, uid, ids, msg, vals={}, 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 isinstance(ids, (str, int, long)):
ids = [ids]
msg_from = msg['from']
vals.update({
- 'description': msg['body']
+ 'description': msg['body_text']
})
if msg.get('priority', False):
vals['priority'] = msg.get('priority')
@@ -364,7 +340,7 @@ class hr_applicant(crm.crm_case, osv.osv):
'probability':'probability'
}
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):
@@ -373,23 +349,7 @@ class hr_applicant(crm.crm_case, osv.osv):
vals.update(vls)
res = self.write(cr, uid, ids, vals, context=context)
-
- 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, ids, msg, context=context)
return res
def case_open(self, cr, uid, ids, *args):
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index a014508a91a..e9951143dbc 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -144,9 +144,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" />
@@ -158,18 +157,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)]}">
+ <group attrs="{'invisible': [('email_from', '=', False)]}">
<field name="body" 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/hr_recruitment/wizard/email_compose_message.py b/addons/hr_recruitment/wizard/email_compose_message.py
index f5cc4883ef3..b2890de02a6 100644
--- a/addons/hr_recruitment/wizard/email_compose_message.py
+++ b/addons/hr_recruitment/wizard/email_compose_message.py
@@ -25,7 +25,7 @@ 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):
'''
@@ -45,13 +45,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:
diff --git a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py
index e07e1442700..cd9cbea52f7 100644
--- a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py
+++ b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py
@@ -50,7 +50,7 @@ class job2phonecall(osv.osv_memory):
return categ_id and categ_id[0] or case.categ_id and case.categ_id.id or False
def _get_note(self, cr, uid, context=None):
- msg_obj = self.pool.get('email.message')
+ mail_message = self.pool.get('mail.message')
if context is None:
context = {}
if context.get('active_id'):
@@ -58,9 +58,9 @@ class job2phonecall(osv.osv_memory):
if case.description:
return case.description
else:
- msg_ids = msg_obj.search(cr, uid, [('model', '=', 'hr.applicant'), ('res_id', '=', case.id), ('email_from', '!=', ''), ('email_to', '!=', '')], limit=1)
+ msg_ids = mail_message.search(cr, uid, [('model', '=', 'hr.applicant'), ('res_id', '=', case.id), ('email_from', '!=', ''), ('email_to', '!=', '')], limit=1)
if msg_ids:
- return msg_obj.browse(cr, uid, msg_ids[0], context=context).description
+ return mail_message.browse(cr, uid, msg_ids[0], context=context).body_text
return False