from datetime import datetime
from osv import fields, osv
from tools.translate import _
+from tools import html2plaintext
AVAILABLE_STATES = [
('draft', 'New'),
'name': fields.char('Name', size=64, required=True, translate=True),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of stages."),
'department_id':fields.many2one('hr.department', 'Specific to a Department', help="Stages of the recruitment process may be different per department. If this stage is common to all departments, keep this field empty."),
- 'state': fields.selection(AVAILABLE_STATES, 'State', required=True, help="The related state for the stage. The state of your document will automatically change according to the selected stage. Example, a stage is related to the state 'Close', when your document reach this stage, it will be automatically closed."),
+ 'state': fields.selection(AVAILABLE_STATES, 'Status', required=True, help="The related status for the stage. The status of your document will automatically change according to the selected stage. Example, a stage is related to the status 'Close', when your document reach this stage, it will be automatically closed."),
'fold': fields.boolean('Hide in views if empty', help="This stage is not visible, for example in status bar or kanban view, when there are no records in that stage to display."),
'requirements': fields.text('Requirements'),
}
'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage',
domain="['&', ('fold', '=', False), '|', ('department_id', '=', department_id), ('department_id', '=', False)]"),
'state': fields.related('stage_id', 'state', type="selection", store=True,
- selection=AVAILABLE_STATES, string="State", readonly=True,
- help='The state is set to \'Draft\', when a case is created.\
- If the case is in progress the state is set to \'Open\'.\
- When the case is over, the state is set to \'Done\'.\
- If the case needs to be reviewed then the state is \
+ selection=AVAILABLE_STATES, string="Status", readonly=True,
+ help='The status is set to \'Draft\', when a case is created.\
+ If the case is in progress the status is set to \'Open\'.\
+ When the case is over, the status is set to \'Done\'.\
+ If the case needs to be reviewed then the status is \
set to \'Pending\'.'),
'categ_ids': fields.many2many('hr.applicant_category', string='Tags'),
'company_id': fields.many2one('res.company', 'Company'),
'email_from': lambda s, cr, uid, c: s._get_default_email(cr, uid, c),
'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),
'department_id': lambda s, cr, uid, c: s._get_default_department_id(cr, uid, c),
- 'priority': lambda *a: '',
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'hr.applicant', context=c),
'color': 0,
}
'stage_id': _read_group_stage_ids
}
- def onchange_job(self,cr, uid, ids, job, context=None):
+ def onchange_job(self, cr, uid, ids, job, context=None):
result = {}
if job:
res['context'] = {
'default_partner_ids': applicant.partner_id and [applicant.partner_id.id] or False,
'default_user_id': uid,
- 'default_state': 'open',
'default_name': applicant.name,
'default_categ_ids': category and [category.id] or False,
}
This override updates the document according to the email.
"""
if custom_values is None: custom_values = {}
+ desc = html2plaintext(msg.get('body')) if msg.get('body') else ''
custom_values.update({
'name': msg.get('subject') or _("No Subject"),
- 'description': msg.get('body'),
+ 'description': desc,
'email_from': msg.get('from'),
'email_cc': msg.get('cc'),
'user_id': False,
if context is None:
context = {}
for applicant in self.browse(cr, uid, ids, context=context):
+ if applicant.job_id:
+ self.pool.get('hr.job').message_post(cr, uid, [applicant.job_id.id], body=_('New employee joined the company %s.')%(applicant.name,), subtype="hr_recruitment.mt_hired", context=context)
if applicant.emp_id:
message = _("Applicant has been <b>hired</b> and created as an employee.")
- self.message_post(cr, uid, [applicant.id], body=message, subtype="mt_recruitment_hired", context=context)
+ self.message_post(cr, uid, [applicant.id], body=message, context=context)
else:
message = _("Applicant has been <b>hired</b>.")
- self.message_post(cr, uid, [applicant.id], body=message, subtype="mt_recruitment_hired", context=context)
+ self.message_post(cr, uid, [applicant.id], body=message, context=context)
return True
def case_cancel_send_note(self, cr, uid, ids, context=None):
msg = 'Applicant <b>refused</b>.'
- return self.message_post(cr, uid, ids, body=msg, subtype="mt_recruitment_refused", context=context)
+ return self.message_post(cr, uid, ids, body=msg, context=context)
def case_reset_send_note(self, cr, uid, ids, context=None):
message =_("Applicant has been set as <b>new</b>.")
- return self.message_post(cr, uid, ids, body=message, subtype="mt_recruitment_new", context=context)
+ return self.message_post(cr, uid, ids, body=message, context=context)
def create_send_note(self, cr, uid, ids, context=None):
message = _("Applicant has been <b>created</b>.")
- return self.message_post(cr, uid, ids, body=message, subtype="mt_recruitment_new", context=context)
-
+ for applicant in self.browse(cr, uid, ids, context=context):
+ if applicant.job_id:
+ self.pool.get('hr.job').message_post(cr, uid, [applicant.job_id.id], body=message, subtype="hr_recruitment.mt_applicant_new", context=context)
+ return self.message_post(cr, uid, ids, body=message, context=context)
class hr_job(osv.osv):
_inherit = "hr.job"
help="Email alias for this job position. New emails will automatically "
"create new applicants for this job position."),
}
-
_defaults = {
'alias_domain': False, # always hide alias during creation
}
datas['model'] = 'survey.print'
context.update({'response_id': [0], 'response_no': 0,})
return {
- 'type': 'ir.actions.report.xml',
- 'report_name': 'survey.form',
- 'datas': datas,
- 'context' : context,
- 'nodestroy':True,
- }
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'survey.form',
+ 'datas': datas,
+ 'context' : context,
+ 'nodestroy':True,
+ }
class applicant_category(osv.osv):
""" Category of applicant """