I have created a scheduled action on ir.cron , and i want to change the task from one stage to another stage based on deadline on the task.
Maybe there will be 3 projects with different tasks , how to get the tasks that belong only to a project through code , and how to stop it after only one change of stage when the deadline has passed.
def _change_task(self):
today = date.today()
get_list = self.env['project.task'].search([('date_deadline', ', today)])
get_task = self.env['project.task.type'].search([(])
for rec in get_task:
for line in get_list:
line.write({
'stage_id': rec.id,
})
return True