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

How to set my date default value as 05/08/2022??

아바타
취소
베스트 답변

You can do it as below:

my_date = fields.Date(string='My Date', default=lambda self: fields.Date.context_today(self).replace(day=8,month=5,year=2022))

아바타
취소
작성자

It's working, where we can define the specific date format like DD/MM/YYYY

You can change it from Languages, Enable developer mode then Go to Settings -> Translations -> Languages -> open your language and edit the date format field to %d/%m/%Y

작성자

I tried the same but date showing 2022-05-08

You need to refresh the page. Which screen you check it?

관련 게시물 답글 화면 활동
1
6월 25
1918
3
7월 25
3514
1
5월 25
1633
1
5월 25
1884
4
5월 25
3005