Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
2802 Visualizzazioni

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

Avatar
Abbandona
Risposta migliore

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
Abbandona
Autore

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

Autore

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

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

Post correlati Risposte Visualizzazioni Attività
1
giu 25
1616
3
lug 25
3261
1
mag 25
1403
1
mag 25
1649
4
mag 25
2817