[REM] hr_recruitment: back to social-trunk-tde version, because already developed in another merge proposal
bzr revid: tde@openerp.com-20120320172058-is9xef2flxm6b68l
This commit is contained in:
@@ -171,6 +171,7 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
'partner_mobile': fields.char('Mobile', size=32),
|
||||
'type_id': fields.many2one('hr.recruitment.degree', 'Degree'),
|
||||
'department_id': fields.many2one('hr.department', 'Department'),
|
||||
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True),
|
||||
'survey': fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
|
||||
'response': fields.integer("Response"),
|
||||
'reference': fields.char('Refered By', size=128),
|
||||
@@ -180,7 +181,6 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
'day_close': fields.function(_compute_day, string='Days to Close', \
|
||||
multi='day_close', type="float", store=True),
|
||||
'color': fields.integer('Color Index'),
|
||||
'emp_id': fields.many2one('hr.employee', 'employee'),
|
||||
'user_email': fields.related('user_id', 'user_email', type='char', string='User Email', readonly=True),
|
||||
}
|
||||
|
||||
@@ -391,65 +391,31 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
self.message_append_dict(cr, uid, ids, msg, context=context)
|
||||
return res
|
||||
|
||||
def _case_open_notification(self, case, context=None):
|
||||
message = _("Changed Status to <b>in Progress<b>.")
|
||||
case.message_append_note('' ,message, type='notification')
|
||||
return True
|
||||
|
||||
def _case_close_notification(self, case, context=None):
|
||||
case[0].message_mark_done(context)
|
||||
if case[0].emp_id:
|
||||
message = _("Applicant is <b>hired</b> and employee created.")
|
||||
case[0].message_append_note('' ,message, type='notification')
|
||||
else:
|
||||
message = _("Applicant is <b>hired</b>.")
|
||||
case[0].message_append_note('' ,message, type='notification')
|
||||
return True
|
||||
|
||||
def _case_cancel_notification(self, case, context=None):
|
||||
case[0].message_mark_done(context=context)
|
||||
message = _("Applicant is <b>cancelled<b>.")
|
||||
case[0].message_append_note('' ,message, type="notification")
|
||||
return True
|
||||
|
||||
def _case_pending_notification(self, case, context=None):
|
||||
message = _("Changed Status to <b>pending<b>.")
|
||||
case[0].message_append_note('' ,message, type='notification')
|
||||
return True
|
||||
|
||||
def _case_reset_notification(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_append_note(cr, uid, ids, _('System notification'),
|
||||
_("Changed Status to <b>new<b>."), type='notification', need_action_user_id=obj.user_id.id, context=context)
|
||||
return True
|
||||
|
||||
def create_notificate(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
self.message_subscribe(cr, uid, ids, [obj.user_id.id], context=context)
|
||||
self.message_append_note(cr, uid, ids, _('System notification'),
|
||||
_("Applicant is <b>created</b>."), type='notification', need_action_user_id=obj.user_id.id, context=context)
|
||||
return True
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
obj_id = super(hr_applicant, self).create(cr, uid, vals, context=context)
|
||||
self.create_notificate(cr, uid, [obj_id], context=context)
|
||||
return obj_id
|
||||
|
||||
def case_open(self, cr, uid, ids, context=None):
|
||||
def case_open(self, cr, uid, ids, *args):
|
||||
"""
|
||||
open Request of the applicant for the hr_recruitment
|
||||
@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 case's Ids
|
||||
@param *args: Give Tuple Value
|
||||
"""
|
||||
res = super(hr_applicant, self).case_open(cr, uid, ids, context)
|
||||
res = super(hr_applicant, self).case_open(cr, uid, ids, *args)
|
||||
date = self.read(cr, uid, ids, ['date_open'])[0]
|
||||
if not date['date_open']:
|
||||
self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S'),})
|
||||
for (id, name) in self.name_get(cr, uid, ids):
|
||||
message = _("The job request '%s' has been set 'in progress'.") % name
|
||||
self.log(cr, uid, id, message)
|
||||
return res
|
||||
|
||||
def case_close(self, cr, uid, ids, context=None):
|
||||
res = super(hr_applicant, self).case_close(cr, uid, ids, context)
|
||||
def case_close(self, cr, uid, ids, *args):
|
||||
res = super(hr_applicant, self).case_close(cr, uid, ids, *args)
|
||||
for (id, name) in self.name_get(cr, uid, ids):
|
||||
message = _("Applicant '%s' is being hired.") % name
|
||||
self.log(cr, uid, id, message)
|
||||
return res
|
||||
|
||||
def case_close_with_emp(self, cr, uid, ids, context=None):
|
||||
def case_close_with_emp(self, cr, uid, ids, *args):
|
||||
hr_employee = self.pool.get('hr.employee')
|
||||
model_data = self.pool.get('ir.model.data')
|
||||
act_window = self.pool.get('ir.actions.act_window')
|
||||
@@ -465,8 +431,7 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
'address_home_id': address_id,
|
||||
'department_id': applicant.department_id.id
|
||||
})
|
||||
self.write(cr, uid, [applicant.id], {'emp_id': emp_id})
|
||||
self.case_close(cr, uid, [applicant.id], context)
|
||||
self.case_close(cr, uid, [applicant.id], *args)
|
||||
else:
|
||||
raise osv.except_osv(_('Warning!'),_('You must define Applied Job for this applicant.'))
|
||||
|
||||
@@ -477,25 +442,17 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
dict_act_window['view_mode'] = 'form,tree'
|
||||
return dict_act_window
|
||||
|
||||
def case_cancel(self, cr, uid, ids, context=None):
|
||||
"""Overrides cancel for crm_case for setting probability
|
||||
"""
|
||||
res = super(hr_applicant, self).case_cancel(cr, uid, ids, context)
|
||||
self.write(cr, uid, ids, {'probability' : 0.0})
|
||||
return res
|
||||
|
||||
def case_pending(self, cr, uid, ids, context=None):
|
||||
"""Marks case as pending"""
|
||||
res = super(hr_applicant, self).case_pending(cr, uid, ids, context)
|
||||
self.write(cr, uid, ids, {'probability' : 0.0})
|
||||
return res
|
||||
|
||||
def case_reset(self, cr, uid, ids, context=None):
|
||||
def case_reset(self, cr, uid, ids, *args):
|
||||
"""Resets case as draft
|
||||
@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 case Ids
|
||||
@param *args: Tuple Value for additional Params
|
||||
"""
|
||||
res = super(hr_applicant, self).case_reset(cr, uid, ids, context)
|
||||
|
||||
res = super(hr_applicant, self).case_reset(cr, uid, ids, *args)
|
||||
self.write(cr, uid, ids, {'date_open': False, 'date_closed': False})
|
||||
self._case_reset_notification(cr, uid, ids, context)
|
||||
return res
|
||||
|
||||
def set_priority(self, cr, uid, ids, priority, *args):
|
||||
@@ -516,8 +473,8 @@ class hr_applicant(crm.crm_case, osv.osv):
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if 'stage_id' in vals and vals['stage_id']:
|
||||
stage = self.pool.get('hr.recruitment.stage').browse(cr, uid, vals['stage_id'], context=context)
|
||||
self.message_append_note(cr, uid, ids, _('System notification'),
|
||||
_("Changed stage to <b>%s</b>.") % stage.name, type='notification')
|
||||
text = _("Changed Stage to: %s") % stage.name
|
||||
self.message_append(cr, uid, ids, text, body_text=text, context=context)
|
||||
return super(hr_applicant,self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
hr_applicant()
|
||||
|
||||
@@ -79,9 +79,6 @@
|
||||
<field name="partner_name"/>
|
||||
<field name="job_id" on_change="onchange_job(job_id)"/>
|
||||
<button name="action_makeMeeting" type="object" string="Meeting" icon="gtk-index"/>
|
||||
<button string="Send New Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
icon="terp-mail-message-new" type="action"/>
|
||||
<newline/>
|
||||
<field name="department_id" widget="selection" on_change="onchange_department_id(department_id)"/>
|
||||
<group colspan="2" col="4">
|
||||
@@ -127,6 +124,13 @@
|
||||
<field name="source_id"/>
|
||||
<field name="reference"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Dates"/>
|
||||
<field name="create_date"/>
|
||||
<field name="write_date"/>
|
||||
<field name="date_closed"/>
|
||||
<field name="date_open"/>
|
||||
</group>
|
||||
<separator colspan="4" string="Status"/>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
|
||||
@@ -137,11 +141,33 @@
|
||||
<button name="case_reset" string="Reset to New" states="done,cancel" type="object" icon="gtk-convert"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Communication & History" groups="base.group_extended">
|
||||
<group colspan="4">
|
||||
<field colspan="4" name="email_cc" string="Global CC" widget="char"/>
|
||||
</group>
|
||||
<field name="message_ids" colspan="4" nolabel="1" mode="tree" readonly="1">
|
||||
<tree string="History">
|
||||
<field name="display_text" string="History Information"/>
|
||||
<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>
|
||||
</field>
|
||||
<button string="Add Internal Note"
|
||||
name="%(crm.action_crm_add_note)d"
|
||||
context="{'model': 'crm.lead' }"
|
||||
icon="terp-document-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="Notes">
|
||||
<field name="description" nolabel="1" colspan="4"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user