Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
2943 Näkymät

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

Avatar
Hylkää
Paras vastaus

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
Hylkää
Tekijä

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

Tekijä

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

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

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
syysk. 25
1987
1
kesäk. 25
2014
3
heinäk. 25
3592
1
toukok. 25
1718
4
toukok. 25
3063