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

i created a form for termination of an employee i have the join date and end date of the employee.. what i want is how many days this employee had worked between these two dates ie: number of working days between two dates

아바타
취소
베스트 답변

Hello faizan,


Hope you are doing well.


You can calculate working days using the compute method

write you code like this.


from datetime import date


    employee_join_date = fields.Datetime(string='Employee Start Date')

    employee_end_date = fields.Datetime(string='Employee End Date')

    workdays = fields.Integer(string='Employee Working Days',compute='compute_calculate_workday')


    @api.depends('employee_end_date','employee_end_date')

    def compute_calculate_workday(self):

        for rec in self:

            rec.workdays = (rec.employee_join_date - rec.employee_end_date).days


I Hope this information proves helpful to you.

Thanks & Regards,

Email:   odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari 

아바타
취소
베스트 답변

hope you find out the anwser

아바타
취소
관련 게시물 답글 화면 활동
1
5월 25
1103
1
3월 25
1217
0
2월 25
1435
1
12월 24
1886
0
11월 24
108