[IMP]changing form title on basis of attendance status
bzr revid: dhr@tinyerp.com-20120508131553-4mlznby2u768xf6t
This commit is contained in:
@@ -71,15 +71,6 @@ class hr_sign_in_out(osv.osv_memory):
|
||||
'state': fields.char('Current state', size=32, required=True, readonly=True),
|
||||
'emp_id': fields.many2one('hr.employee', 'Empoyee ID', readonly=True),
|
||||
}
|
||||
# def set_name(self,cr,uid,id,context=None):
|
||||
# act_obj=self.pool.get('ir.actions.act_window')
|
||||
# action_id = act_obj.search(cr, uid, [('res_model','=','hr.sign.in.out')],context=context)
|
||||
# action = act_obj.browse(cr, uid, action_id[0], context=context)
|
||||
# #data = self.read(cr, uid, id, [], context=context)[0]
|
||||
# if data['state']=='present':
|
||||
# name = act_obj.write(cr, uid, action_id[0], {'name':'Sign Out'}, context=context)
|
||||
# if data['state']=='absent':
|
||||
# name = act_obj.write(cr, uid, action_id[0], {'name':'Sign In'}, context=context)
|
||||
|
||||
def _get_empid(self, cr, uid, context=None):
|
||||
emp_id = context.get('emp_id', self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context))
|
||||
@@ -89,9 +80,15 @@ class hr_sign_in_out(osv.osv_memory):
|
||||
return {}
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
#self.set_name(cr, uid, uid, context)
|
||||
res = super(hr_sign_in_out, self).default_get(cr, uid, fields_list, context=context)
|
||||
res_emp = self._get_empid(cr, uid, context=context)
|
||||
act_obj=self.pool.get('ir.actions.act_window')
|
||||
action_id = act_obj.search(cr, uid, [('res_model','=','hr.sign.in.out')],context=context)
|
||||
action = act_obj.browse(cr, uid, action_id[0], context=context)
|
||||
if res_emp['state']=='present':
|
||||
name = act_obj.write(cr, uid, action_id[0], {'name':'Sign Out'}, context=context)
|
||||
if res_emp['state']=='absent':
|
||||
name = act_obj.write(cr, uid, action_id[0], {'name':'Sign In'}, context=context)
|
||||
res.update(res_emp)
|
||||
return res
|
||||
|
||||
|
||||
Reference in New Issue
Block a user