Hello everyone,
I'm trying to get the "Last Update Status" variable in the Project to update automatically depending on the current date. I was thinking of doing this using a scheduled action. I've attached some screenshots.
I would like the bubble to change automatically where you can put if thebproject is to define, on risk, on track...
Here is the scheduled action I'm working on:
today = fields.Date.today()
for proyecto in model.search([]):
fecha = proyecto.x_studio_fecha_de_finalizacin
if not fecha:
estado = 'to_define'
color = 0 # gris
else:
dias = (fecha - today).days
if dias < 0:
estado = 'off_track'
color = 1 # rojo
elif dias <= 2:
estado = 'at_risk'
color = 3 # amarillo
else:
estado = 'on_track'
color = 10 # verde
proyecto.write({
'last_update_status': estado,
'last_update_color': color,
})
I appreciate your help — I've always programmed in Python, but I don't fully understand how to do it in Odoo.
Best regards,
Marcos