Divyesh Makwana(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-893626-mdi into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #893626 in OpenERP Addons: "job position, bad computation of employee 
field"
  https://bugs.launchpad.net/openobject-addons/+bug/893626

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-893626-mdi/+merge/83269

Hello Sir,

I have fix the issue: https://bugs.launchpad.net/openobject-addons/+bug/893626 
"job position, bad computation of employee field".

Thanks and Regards,

Divyesh Makwana(MDI)
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-893626-mdi/+merge/83269
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-893626-mdi.
=== modified file 'hr/hr.py'
--- hr/hr.py	2011-11-09 18:12:56 +0000
+++ hr/hr.py	2011-11-24 10:18:37 +0000
@@ -79,12 +79,27 @@
             }
         return res
 
+    def _get_job_position(self, cr, uid, ids, context=None):
+        result = {}
+        for data in self.pool.get('hr.employee').browse(cr, uid, ids, context=context):
+            if data.job_id:
+                result[data.job_id.id] = True
+        return result.keys()
+
     _name = "hr.job"
     _description = "Job Description"
     _columns = {
         'name': fields.char('Job Name', size=128, required=True, select=True),
-        'expected_employees': fields.function(_no_of_employee, string='Expected Employees', help='Required number of Employees in total for that job.', multi="no_of_employee", store=True),
-        'no_of_employee': fields.function(_no_of_employee, string="No of Employee", help='Number of employee with that job.', multi="no_of_employee", store=True),
+        'expected_employees': fields.function(_no_of_employee, string='Expected Employees', help='Required number of Employees in total for that job.',
+             store={
+                'hr.employee': (_get_job_position, ['job_id'], 10),
+                },
+            multi='no_of_employee'),
+        'no_of_employee': fields.function(_no_of_employee, string="No of Employee", help='Number of employee with that job.',
+             store={
+                'hr.employee': (_get_job_position, ['job_id'], 10),
+                },
+            multi='no_of_employee'),
         'no_of_recruitment': fields.float('Expected in Recruitment'),
         'employee_ids': fields.one2many('hr.employee', 'job_id', 'Employees'),
         'description': fields.text('Job Description'),
@@ -98,7 +113,7 @@
         'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr.job', context=c),
         'state': 'open',
     }
-    
+
     _sql_constraints = [
         ('name_company_uniq', 'unique(name, company_id)', 'The name of the job position must be unique per company!'),
     ]
@@ -242,7 +257,7 @@
 
     def create(self, cr, uid, data, context=None):
         user_id = super(res_users, self).create(cr, uid, data, context=context)
-        
+
         # add shortcut unless 'noshortcut' is True in context
         if not(context and context.get('noshortcut', False)):
             data_obj = self.pool.get('ir.model.data')
@@ -254,7 +269,7 @@
             except:
                 # Tolerate a missing shortcut. See product/product.py for similar code.
                 logging.getLogger('orm').debug('Skipped meetings shortcut for user "%s"', data.get('name','<new'))
-        
+
         return user_id
 
 res_users()

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to