Ir al contenido
Menú
Se marcó esta pregunta

in an organization leave allocation for a group of employees happens in float numbers, Example Paid:0.5,Casual 0.5. So in general case an employee cannot apply for leave under paid or casual. But  Here, even if the employee has insufficient leave days, the next category leave has to be selected, and should be deducted from it. Example if i select Paid leave for 1 day, 0.5 will be taken from paid and 0.5 from casual should be deducted and will be added to paid leave.

I was successfull in adding the leaves, with this logic

hol_id =  holiday_obj.create(cr, uid, {'name': _('AUTO ALLOCATED'), 'employee_id': record.employee_id.id, 'holiday_status_id': record.holiday_status_id.id, 'type': 'add', 'holiday_type': 'employee', 'number_of_days_temp': int(abs(leave_days['virtual_remaining_leaves'])),'state':'validate'}, context=context)
                            self.write(cr, uid,[hol_id],{'state':'validate'})

I sent type=add and number_of_days_temp, it successfully added. But when iam deducting leaves by this logic

 

leave_id =  holiday_obj.create(cr, uid, {'name': _('removel test '), 'employee_id': record.employee_id.id, 'holiday_status_id': r['id'], 'type': 'remove', 'holiday_type': 'employee', 'number_of_days_temp': int(abs(leave_days['virtual_remaining_leaves'])),'state':'validate'}, context=context)
                            self.write(cr, uid,[leave_id],{'state':'validate'})

When iam sending type=remove, it was raising an exception, stating String Expected ,Bool returned..

 

MY explanation may be lengthy , because requirement if typical.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
sept 18
5523
0
feb 16
3634
0
ago 15
5478
1
mar 15
458
3
mar 15
437