Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
2562 Widoki

Hello Odoo community, 

    Please help me with the python expression: I wish to program the planned start time of a task the same as the time when the kanban state of the task changed. How do I code it in automated action? Thank you

This is what I have so far:
Model: Task; Trigger: On update; Trigger field: kanban state (project.task);
Domain: Kanban state="normal"; Apply on: Kanban state = "blocked"; Action to Do: update the record
Then for field: planned start (project.task) and planned stop project task, I don't know what to choose under Evaluation type and put under value
I want the planned start date to be the day when kanban state changed, and the planned end date to be 1 day after

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

I hope that the planned_start_date(Planned Start Date) and planned_end_date(Planned End Date) are your custom fields which are to be updated on changing the Kanban State from normal(In Progress) to blocked(Blocked). You can use the configurations(values set for the fields in automated action) as you set already.

Model: Task; Trigger: On update; Trigger field: kanban state (project.task);
Domain: Kanban state="normal"; Apply on: Kanban state = "blocked";

Here I am using the Action to Do: Execute Python Code. So, set it and add the code below in the space for Python Code.

if records:
records.write({
# if you have planned_start_date and planned_end_date as date fields:
# 'planned_start_date': datetime.date.today(),
# 'planned_end_date': datetime.date.today() + dateutil.relativedelta.relativedelta(days=1)

# if you have planned_start_date and planned_end_date as datetime fields:
'planned_start_date': datetime.datetime.today(),
'planned_end_date': datetime.datetime.today() + dateutil.relativedelta.relativedelta(
days=1)
})

Regards

Awatar
Odrzuć
Autor

Thanks a lot! For some reasons, it doesn't work with Action to Do: Execute Python Code but work with Action to Do: update the record, though using the same python expression.

Powiązane posty Odpowiedzi Widoki Czynność
1
lis 23
2082
2
gru 23
5654
1
sie 22
2621
2
sty 22
5760
1
lip 20
3519