콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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.

아바타
취소
관련 게시물 답글 화면 활동
3
9월 18
5482
0
2월 16
3605
0
8월 15
5443
1
3월 15
428
3
3월 15
418