Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
884 มุมมอง

Is there a way, thru an automated action or something similar, to automatically set Project task deadlines 2 weeks after the set planned start date located in the project card, three dots, settings, planned date?


 



อวตาร
ละทิ้ง

Yes, you can automate this in Odoo using an Automated Action!

You want an automation that:

  • Watches the Project Task model.
  • When a task’s Planned Start Date is set or updated,
  • It automatically sets the Deadline to 2 weeks (14 days) after the start date.

Here's how you can do it step-by-step:

  • Go to:
    Settings > Technical > Automation > Automated Actions
  • Create a New Automated Action:
    • Name: Set Task Deadlines Based on Project Planned Date
    • Model: Project (project.project)
    • Trigger: On Update
    • Trigger Fields: Planned Date (date_start)
    • Action To Do: Execute Python Code


if record.date_start:

    for task in record.task_ids:

        task.date_deadline = record.date_start + timedelta(days=14)

Important:

  • This updates all tasks under the project when you change the project's start date.
  • It will overwrite existing deadlines of tasks — unless you add conditions to skip tasks with already set deadlines (optional — I can show you that if needed).

    I hope it will help you. If you need more help, feel free to contact meme at bitlevelcode@gmail.com

ผู้เขียน

Here is a screenshot of the automated action:

ผู้เขียน คำตอบที่ดีที่สุด

Based on Mukesh's wonderful guidance, we were able to get this resolved by doing the following:

In the screenshot you shared, I noticed that you selected "Update the record" in the "Action to Do" field. Please change it to "Execute Python Code" instead.

I'm attaching a screenshot for your reference. Kindly review it and let me know once you've completed the testing.

Also, please update the code with the following:


if record.date_start: for task in record.task_ids: task.write({'date_deadline': record.date_start + datetime.timedelta(days=14)})


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Okay. You write the automation action in the wrong way.

If possible, contact me at bitlevelcode@gmail.com

I'll try my best to solve your problem. Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ค. 25
846
1
ม.ค. 23
2888
1
เม.ย. 20
2425
2
ก.ย. 23
2902
Project- Odoo 14 แก้ไขแล้ว
1
เม.ย. 21
4430