[IMP] hr_recruitment: Improve applicant form view, correct stages for applicant
authorpsi (Open ERP) <psi@tinyerp.co.in>
Thu, 10 Jun 2010 04:38:03 +0000 (10:08 +0530)
committerpsi (Open ERP) <psi@tinyerp.co.in>
Thu, 10 Jun 2010 04:38:03 +0000 (10:08 +0530)
bzr revid: psi@tinyerp.co.in-20100610043803-f1m5c0z9d29rsqig

1  2 
addons/hr_recruitment/hr_recruitment.py
addons/hr_recruitment/hr_recruitment_data.xml
addons/hr_recruitment/hr_recruitment_view.xml
addons/hr_recruitment/report/hr_recruitment_report_view.xml

@@@ -61,9 -61,9 +61,9 @@@ class hr_applicant(osv.osv, crm.crm_cas
  
      _columns = {
          'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
--        'name': fields.char('Name', size=128, required=True), 
--        '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'), 
++        'name': fields.char('Name', size=128, required=True),
++        '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'),
          'section_id': fields.many2one('crm.case.section', 'Sales Team', \
                          select=True, help='Sales team to which Case belongs to.\
                               Define Responsible user and Email account for mail gateway.'),
@@@ -77,9 -77,9 +77,9 @@@
                                   domain="[('partner_id','=',partner_id)]"),
          'create_date': fields.datetime('Creation Date' , readonly=True),
          'write_date': fields.datetime('Update Date' , readonly=True),
--        'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
--                         domain="[('section_id','=',section_id),\
--                        ('object_id.model', '=', 'crm.opportunity')]"),
++#        'stage_id': fields.many2one ('crm.case.stage', 'Stage', \
++#                         domain="[('section_id','=',section_id),\
++#                        ('object_id.model', '=', 'crm.opportunity')]"),
          'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True,
                                    help='The state is set to \'Draft\', when a case is created.\
                                    \nIf the case is in progress the state is set to \'Open\'.\
          'date': fields.datetime('Date'),
          'priority': fields.selection(AVAILABLE_PRIORITIES, 'Appreciation'),
          'job_id': fields.many2one('hr.job', 'Applied Job'),
--        'salary_proposed': fields.float('Proposed Salary'),
--        'salary_expected': fields.float('Expected Salary'),
++        'salary_proposed': fields.float('Proposed Salary', help="Salary Proposed by the Organisation"),
++        'salary_expected': fields.float('Expected Salary', help="Salary Expected by Applicant"),
          'availability': fields.integer('Availability (Days)'),
          'partner_name': fields.char("Applicant's Name", size=64),
          'partner_phone': fields.char('Phone', size=32),
          'partner_mobile': fields.char('Mobile', size=32),
--        'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
++#        'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
++        'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage'),
          'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
          '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"),
      }
--    
++
++    def _get_stage(self, cr, uid, context=None):
++        if context is None:
++            context = {}
++        ids = self.pool.get('hr.recruitment.stage').search(cr, uid, [], context=context)
++        return ids and ids[0] or False
++
      _defaults = {
--        'active': lambda *a: 1, 
--        'user_id': crm.crm_case._get_default_user, 
--        'email_from': crm.crm_case. _get_default_email, 
++        'active': lambda *a: 1,
++        'stage_id': _get_stage,
++        'user_id':  lambda self, cr, uid, context: uid,
++#        'user_id': crm.crm_case._get_default_user,
++        'email_from': crm.crm_case. _get_default_email,
          'state': lambda *a: 'draft',
--        'section_id': crm.crm_case. _get_section, 
--        'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c), 
--        'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0], 
++        'section_id': crm.crm_case. _get_section,
++        'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
++        'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
      }
  
      def onchange_job(self,cr, uid, ids, job, context={}):
  
      <record model="hr.recruitment.stage" id="stage_job1">
          <field name="name">Initial Jobs Demand</field>
++        <field name="sequence">1</field>
          <field name="object_id" search="[('model','=','hr.applicant')]" model="ir.model"/>
      </record>
      <record model="hr.recruitment.stage" id="stage_job2">
          <field name="name">First Interview</field>
++        <field name="sequence">2</field>
          <field name="object_id" search="[('model','=','hr.applicant')]" model="ir.model"/>
      </record>
      <record model="hr.recruitment.stage" id="stage_job3">
          <field name="name">Second Interview</field>
++        <field name="sequence">3</field>
          <field name="object_id" search="[('model','=','hr.applicant')]" model="ir.model"/>
      </record>
      <record model="hr.recruitment.stage" id="stage_job4">
          <field name="name">Contract Proposed</field>
++        <field name="sequence">4</field>
          <field name="object_id" search="[('model','=','hr.claim')]" model="ir.model"/>
      </record>
      <record model="hr.recruitment.stage" id="stage_job5">
          <field name="name">Contract Signed</field>
++        <field name="sequence">5</field>
          <field name="object_id" search="[('model','=','hr.applicant')]" model="ir.model"/>
      </record>
      <record model="hr.recruitment.stage" id="stage_job6">
          <field name="name">Refused by Employee</field>
++        <field name="sequence">6</field>
          <field name="object_id" search="[('model','=','hr.applicant')]" model="ir.model"/>
      </record>
      <record model="hr.recruitment.stage" id="stage_job7">
          <field name="name">Refused by Company</field>
++        <field name="sequence">7</field>
          <field name="object_id" search="[('model','=','hr.applicant')]" model="ir.model"/>
      </record>
++
++    <!--  Department(section_id)    -->
++    <record model="crm.case.section" id="section_hr_department">
++            <field name="name">HR Department</field>
++            <field name="code">HR</field>
++    </record>
  </data>
  </openerp>
          <field name="arch" type="xml">
              <form string="Jobs - Recruitment Form">
                  <group colspan="4" col="8">
--                     <group colspan="3" col="6">
                          <field name="name" string="Subject"/>
++                        <field name="partner_name"/>
++                        <field name="job_id" on_change="onchange_job(job_id)"/>
++                        <button string="Schedule a Phone Call" name="%(action_hr_recruitment_phonecall)d" icon="gtk-redo" type="action"/>
++                        <button name="action_makeMeeting" type="object" string="Schedule Meeting" icon="terp-hr"/>
++                    <newline/>
++                    <group colspan="2" col="4">
                          <field name="stage_id"/>
                          <button name="stage_previous" string="" type="object" icon="gtk-go-back"/>
                          <button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
                      </group>
--                    <newline/>
--                    <group colspan="3" col="6">
--                              <field name="partner_name"/>
--                              <field name="job_id" on_change="onchange_job(job_id)"/>
--                              <button string="Schedule a Phone Call" name="%(action_hr_recruitment_phonecall)d" icon="gtk-redo" type="action"/>
--                     </group>
--                    <newline/>
--                    <group colspan="3" col="6">
                          <field name="user_id"/>
                          <field name="department_id" widget="selection"/>
--                        <button name="action_makeMeeting" type="object" string="Schedule Meeting" icon="terp-hr"/>
--                    </group>
--                    <button name="action_print_survey" string="Print Interview" type="object" icon="gtk-print" attrs="{'readonly':[('survey','=',False)]}" groups="base.group_extended"/>
--                    <button name="%(survey.action_view_survey_question_message)d" string="Interview Question" type="action" icon="gtk-execute" context="{'survey_id': survey, 'response_id': [response], 'response_no':0 ,'active' : response, 'object' : 'hr.applicant', 'cur_id' :active_id}" attrs="{'readonly':[('survey','=',False)]}" groups="base.group_extended"/>
++                        <button name="action_print_survey" string="Print Interview" type="object" icon="gtk-print" attrs="{'readonly':[('survey','=',False)]}"/>
++                        <button name="%(survey.action_view_survey_question_message)d" string="Interview Question" type="action" icon="gtk-execute" context="{'survey_id': survey, 'response_id': [response], 'response_no':0 ,'active' : response, 'object' : 'hr.applicant', 'cur_id' :active_id}" attrs="{'readonly':[('survey','=',False)]}" groups="base.group_extended"/>
                </group>
                  <notebook colspan="4">
                      <page string="Job Info">