Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I want to create a server action that automatically set the deadline of a task in 7 days from today. I already succeed to create a server action that sets today as the deadline date by using the Action Type Write Object and writing the following formula in the deadline field:
As I am not programmer and do not not any phyton I am struggling to find the formula for today + 7 days
For all the other users, here are the steps to follow in order to automatically set deadlines on Tasks.
- From the task kanban or list view, create two advanced filters for each stage: Stage is equal to stage_name, Stage is not equal to stage_name.
- In Settings > Technical > Automated Actions, create a new record for all the stages for which you want to set an automatic deadline:
- Name: i.e. Set task's deadline to D+7 when stage = New
- Model: Task
Before Update Filter (pre-condition): retrieve the created filter "Stage is not equal to stage_name" in the list. If you want to add a deadline for the first stage (i.e. New), do not add this pre-condition in the automated action dedicated to the first stage, otherwise it won't work. Further, add "['date_deadline', '=',False]" in its post-condition filter domain in order to avoid an infinite loop. Indeed, without pre-condition, the post-condition would be always valid.
After Update Filter (post-condition): retrieve the created filter "Stage is equal to stage_name" in the list.
Create a new action:
Action type: Write object
Value: time.strftime('%Y-%m-%d %H:%M:%S',time.gmtime(time.time()+7243600))
You can change the number of allowed days by replacing 7 in the formula (7 days).
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 9/6/13, 6:34 AM|
|Seen: 3201 times|
|Last updated: 1/18/17, 4:51 AM|