Hi. I create a field date in my module class file, and I want to put automatically the day of today (for example) as default date. Help me please. thx
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- 客户关系管理
- e-Commerce
- 会计
- 库存
- PoS
- Project
- MRP
此问题已终结
4
回复
32246
查看
ok thx, it works, I do this :
_defaults= {
'record_date': fields.date.context_today,
}
import time
admission_date = fields.Date('Admission Date', default=date.today())
In this code is used to generate default current date
You have to add this:
import time
and you can add this to _defaults
_defaults= {
'date_field': lambda *a: time.strftime('%Y-%m-%d'),
}
相关帖文 | 回复 | 查看 | 活动 | |
---|---|---|---|---|
|
0
1月 20
|
604 | ||
|
1
11月 22
|
3192 | ||
|
3
11月 21
|
25807 | ||
|
1
8月 15
|
5345 | ||
|
2
3月 15
|
5277 |
from_date = fields.Date(string="From Date" ,default=datetime.now())