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:
- CRM
- e-Commerce
- Бухоблік
- Склад
- PoS
- Project
- MRP
Це запитання позначене
4
Відповіді
32127
Переглядів
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'),
}
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
РеєстраціяRelated Posts | Відповіді | Переглядів | Дія | |
---|---|---|---|---|
|
0
січ. 20
|
604 | ||
|
1
лист. 22
|
3104 | ||
|
3
лист. 21
|
25665 | ||
|
1
серп. 15
|
5274 | ||
Year only needed - how to implement?
Вирішено
|
|
2
бер. 15
|
5277 |
from_date = fields.Date(string="From Date" ,default=datetime.now())