Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2970 Zobrazení

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

Avatar
Zrušit
Nejlepší odpověď

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

Avatar
Zrušit
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?

Related Posts Odpovědi Zobrazení Aktivita
1
zář 25
2027
1
čvn 25
2074
3
čvc 25
3661
1
kvě 25
1785
4
kvě 25
3093