Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
2817 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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))

Awatar
Odrzuć
Autor

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

Autor

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

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

Powiązane posty Odpowiedzi Widoki Czynność
1
cze 25
1667
3
lip 25
3293
1
maj 25
1433
1
maj 25
1689
4
maj 25
2845