How to do it...

To create an automated action with an event condition on tasks, follow these steps:

  1. In the Settings top menu, select the Technical | Automation | Automated Actions menu item, and press on the Create button
  2. Fill out the basic information on the Automated Actions form:
    • Rule Name: Validate Closing Tasks
    • Related Document Model: Task
    • Conditions tab |When to Run: On Update
    • Action To Do: Execute several actions
  1. The on update rules allow you to set two record filters, before and after the update operation:
    • On the Before Update Filter field, click on the Edit domain button and set a valid domain expression—[('stage_id.name', '!=', 'Done')]—in the code editor and save
    • On the Apply on field, click on the Edit domain button and set the [('stage_id.name', '=', 'Done') domain in the code editor and save
  1. On the Actions tab, click on Add an item, and on the list dialog, click on the Create button to create a new server action
  1. Fill out the server action form with the following values and then press on the Save button:
    • Action Name: Validate Closing Tasks
    • Base Model: Task
    • Action To Do: Execute Python Code
    • Python Code: Enter the following:
if user != record.project_id.user_id: 
    raise Warning('Only the Project Manager can close Tasks') 
    •     The following screenshot shows the entered values:
  1. Click on Save & Close to save the automated action and try it out:
    1. On a database with demo data and logged in as Administrator, go to the Project top menu and click on the E-Learning Integration project to open its task Kanban.
    2. Then, try dragging one of the tasks into the Done stage column. Since this Project's Manager is user Demo and we are working with the user Administrator, our automated action should be triggered, and our warning message is blocking the change.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.113.193