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
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
4
Respuestas
32121
Vistas
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'),
}
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
0
ene 20
|
604 | ||
|
1
nov 22
|
3103 | ||
|
3
nov 21
|
25660 | ||
|
1
ago 15
|
5271 | ||
Year only needed - how to implement?
Resuelto
|
|
2
mar 15
|
5277 |
from_date = fields.Date(string="From Date" ,default=datetime.now())