[IMP] Improved form view of Job Position as per suggestion
authorChirag Dodiya (OpenERP Trainee) <chiragdd7@gmail.com>
Wed, 4 Sep 2013 13:28:08 +0000 (18:58 +0530)
committerChirag Dodiya (OpenERP Trainee) <chiragdd7@gmail.com>
Wed, 4 Sep 2013 13:28:08 +0000 (18:58 +0530)
bzr revid: chiragdd7@gmail.com-20130904132808-clg5cbx6r5g5mv3u

addons/hr/hr_view.xml
addons/hr_recruitment/hr_recruitment.py
addons/hr_recruitment/hr_recruitment_view.xml
addons/hr_recruitment/static/src/css/job_position.css

index 42a2d75..267aace 100644 (file)
                         <div class="oe_right oe_job_button_box" name="buttons"/>
                         <group>
                             <group name="job_data">
-                                <field name="department_id"/>
+                                <field name="department_id" class="oe_inline"/>
                                 <label for="no_of_recruitment"/>
                                 <div>
                                     <field name="no_of_recruitment" on_change="on_change_expected_employee(no_of_recruitment,no_of_employee)" class="oe_inline"/>
-                                    <p>Currently, <field name="no_of_employee" groups="base.group_user" colspan="0" class="oe_inline"/> employees</p>
+                                    <p>Currently, <field name="no_of_employee" groups="base.group_user" colspan="0" class="oe_inline" style="padding-top: 1px"/> employees</p>
                                 </div>
                             </group>
                         </group>
index 2fe4069..313bf4e 100644 (file)
@@ -465,6 +465,14 @@ class hr_job(osv.osv):
         for applicant in applicant_obj.browse(cr, uid, applicant_ids, context=context):
             res[applicant.job_id.id] += 1
         return res
+        
+    def _get_attached_docs(self, cr, uid, ids, field_name, arg, context):
+        res = {}
+        attachment = self.pool.get('ir.attachment')
+        for id in ids:
+            job_attachments = attachment.search(cr, uid, [('res_model', '=', 'hr.job'), ('res_id', '=', id)], context=context, count=True)
+            res[id] = (job_attachments or 0)
+        return res
 
     _columns = {
         'survey_id': fields.many2one('survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"),
@@ -473,6 +481,7 @@ class hr_job(osv.osv):
                                          "create new applicants for this job position."),
         'application_count': fields.function(_application_count, type='integer', string="Total Applications"),
         'manager_id': fields.related('department_id', 'manager_id', type='many2one', string='Department Manager', relation='hr.employee', readonly=True, store=True),
+        'doc_count':fields.function(_get_attached_docs, string="Number of documents attached", type='int')
     }
 
     def _auto_init(self, cr, context=None):
@@ -512,6 +521,20 @@ class hr_job(osv.osv):
             'nodestroy': True,
         }
 
+    def attachment_tree_view(self, cr, uid, ids, context):
+        domain = ['&', ('res_model', '=', 'hr.job'), ('res_id', 'in', ids)]
+        res_id = ids and ids[0] or False
+        return {
+            'name': _('Attachments'),
+            'domain': domain,
+            'res_model': 'ir.attachment',
+            'type': 'ir.actions.act_window',
+            'view_id': False,
+            'view_mode': 'tree,form',
+            'view_type': 'form',
+            'limit': 80,
+            'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, res_id)
+        }
 
 class applicant_category(osv.osv):
     """ Category of applicant """
index afd1a8c..0e8f724 100644 (file)
                 <label for="survey_id" groups="base.group_user"/>
                 <div groups="base.group_user">
                     <field name="survey_id" class="oe_inline" domain="[('type','=','Human Resources')]"/>
+                    <button string="Print Interview" name="action_print_survey" type="object" attrs="{'invisible':[('survey_id','=',False)]}" class="oe_inline oe_link"/>
                 </div>
             </group>
-            <xpath expr="//group[@name='job_data']" position="after">
-                <group name="group_alias"
-                        attrs="{'invisible': [('alias_domain', '=', False)]}">
-                    <label for="alias_name" string="Email Alias"/>
-                    <div name="alias_def">
+            <xpath expr="//field[@name='department_id']" position="after">
+                    <label for="alias_name" string="Email Alias" attrs="{'invisible': [('alias_domain', '=', False)]}"/>
+                    <div name="alias_def" attrs="{'invisible': [('alias_domain', '=', False)]}">
                         <field name="alias_id" class="oe_read_only oe_inline"
                                 string="Email Alias" required="0"/>
                         <div class="oe_edit_only oe_inline" name="edit_alias" style="display: inline;" >
                             <field name="alias_name" class="oe_inline"/>@<field name="alias_domain" class="oe_inline" readonly="1"/>
                         </div>
                     </div>
-                </group>
             </xpath>
             <div name="buttons" position="inside">
                 <button string="Applications" name="%(action_hr_job_applications)d" type="action"/>
-                <button string="Interview" name="action_print_survey" type="object" attrs="{'invisible':[('survey_id','=',False)]}"/>
+                <button name="attachment_tree_view" string="Documents" type="object"/>
             </div>
         </field>
     </record>
                                             <img src="/hr_recruitment/static/src/img/down1.png"/>
                                         </div>
                                     </t>
+                                    <div class="oe_kanban_job_list">
+                                        <a t-if="record.doc_count.raw_value" name="attachment_tree_view" type="object" style="margin-right: 10px"> <field name="doc_count"/> Documents</a>
+                                    </div>
                                     <div class="oe_launch_recruitment">
                                         <a t-if="record.survey_id.raw_value" data-name="action_print_survey" data-type="object" class="oe_kanban_action">Print Interview</a>
                                         <a t-if="record.survey_id.raw_value"> | </a>
             <field name="context">{'search_default_in_recruitment': 1}</field>
             <field name="help" type="html">
               <p class="oe_view_nocontent_create">
-                Click here to create a new job or remove the filter on On Recruitment. Define job position profile and manage all your recruitment in a context of a particular job: print interview survey, define number of expected new employees, and manage its recruitment pipe
+                 Click here to create a new job or remove the filter on "On Recruitment" to recruit for an on hold job. 
+              </p>
+              <p>
+                Define job position profile and manage recruitment in a context of a particular job: print interview survey, define number of expected new employees, and manage its recruitment pipe
               </p>
             </field>
         </record>
index c38847d..a9a1226 100644 (file)
@@ -89,4 +89,8 @@
 }
 .openerp .oe_job_messages{
     margin-top: 40px !important;
-}
\ No newline at end of file
+}
+.openerp .oe_kanban_job_list > a:hover{
+    margin: 4px 0;
+    text-decoration: underline !important;
+}