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


I tried to calculate attendance hours from check in/out,  ... Code work fin in local computer but when install addons on the server. Issue showed up

This is error msg:

Date_check_out =employee.datetime + timedelte(hours=3) 

Unsupported operation type +: 'bool' and datetime.timedelta(hours=3)

Note: attendance list have mane lines of check in /out records

when calculate attendance of employee with no attendance "zero attendance hours" no error happen,    only when attendance have values

odoo12 CE. 

아바타
취소
베스트 답변

Hi,

Regarding this error that you are getting "Unsupported operation type +: 'bool' and datetime.timedelta(hours=3)" , might be due to as there is no value inside the field employee.datetime, as there is no value in the field it will return False, that is why you are getting the above error. Add a if condition and make sure that the field contains value.

Thanks

아바타
취소
작성자 베스트 답변

I solve it by adding if condition. If. It empty will add now date

Thank u all

아바타
취소
베스트 답변

How can I find the difference between the dates in the two fields?

아바타
취소

please use English

베스트 답변

You are trying to add with a bool function and there is a typo error in your code. Instead of function timedelta  you used timedelte. 

try to change like this,

if employee.datetime:
assert isinstance(employee.datetime, datetime), 'Datetime instance expected'
Date_check_out = employee.datetime + timedelta(hours=3)
아바타
취소
관련 게시물 답글 화면 활동
2
6월 25
1060
2
3월 16
16849
5
10월 23
10158
2
6월 25
7021
0
10월 23
1270