跳至內容
選單
此問題已被標幟
1 回覆
2832 瀏覽次數

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
1683
3
7月 25
3311
1
5月 25
1453
1
5月 25
1717
4
5月 25
2861