콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3085 화면

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

아바타
취소
베스트 답변

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

아바타
취소
작성자

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.

관련 게시물 답글 화면 활동
1
11월 23
2641
2
12월 23
6416
1
8월 22
3100
2
1월 22
6521
1
7월 20
4066