[IMP] improved code to show attachments of applicatns , improved help and lable
authorTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Thu, 12 Sep 2013 05:47:39 +0000 (11:17 +0530)
committerTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Thu, 12 Sep 2013 05:47:39 +0000 (11:17 +0530)
bzr revid: tpa@tinyerp.com-20130912054739-nadjpyung33k9ct5

addons/hr/hr_view.xml
addons/hr_recruitment/hr_recruitment.py
addons/hr_recruitment/hr_recruitment_view.xml

index e85add4..0aef0e4 100644 (file)
                     </header>
                     <sheet>
                         <div class="oe_title">
-                            <label string="Job Name" class="oe_edit_only" colspan="4"/>
+                            <label for="name" class="oe_edit_only" colspan="4"/>
                             <h1><field name="name" class="oe_inline" nolabel="1" colspan="2"/></h1>
                         </div>
                         <div class="oe_right" name="buttons"/>
index 13e26e4..db89576 100644 (file)
@@ -471,8 +471,11 @@ class hr_job(osv.osv):
         
     def _get_attached_docs(self, cr, uid, ids, field_name, arg, context=None):
         """Calculate total attached CV per job"""
+        res = {}
         attachment_obj = self.pool.get('ir.attachment')
-        res = {id: attachment_obj.search(cr, uid, [('res_model', '=', 'hr.job'), ('res_id', '=', id)], count=True, context=context) for id in ids}
+        for job_id in ids:
+            res_ids = [job_id] + self.pool.get('hr.applicant').search(cr, uid, [('job_id', '=', job_id)], context=context)
+            res[job_id] = attachment_obj.search(cr, uid, [('res_model', 'in', ['hr.job', 'hr.applicant']), ('res_id', 'in', res_ids)], count=True, context=context)
         return res
 
     _columns = {
@@ -523,7 +526,8 @@ class hr_job(osv.osv):
         }
 
     def attachment_tree_view(self, cr, uid, ids, context):
-        domain = ['&', ('res_model', '=', 'hr.job'), ('res_id', 'in', ids)]
+        res_ids = ids + self.pool.get('hr.applicant').search(cr, uid, [('job_id', 'in', ids)], context=context)
+        domain = ['&', ('res_model', 'in', ['hr.job', 'hr.applicant']), ('res_id', 'in', res_ids)]
         res_id = ids and ids[0] or False
         return {
             'name': _('Attachments'),
index 7bcb702..1efb209 100644 (file)
             <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" to recruit for an on hold job. 
+                 Click here to create a new job or remove the filter on "In 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