Automated Actions to create tasks for Sales Order lines

This is another example of using Automated Actions. When a Sales Order is confirmed this will create tasks (on a project) for each of the sales order lines.

Enable Developer Mode and navigate to Settings / Technical / (Automation) / Automated Actions:

Data to Write:

Python expression:

record.order_id.name + ' / ' + record.product_id.name

This is a very simple example and it can be adapted quite easily.

  • You could write other information to the task by changing the Python expression:

record.product_id.name + ' / ' + str(record.product_uom_qty)

(that will write the Product name and quantity)

Note that Odoo already has standard functionality to create projects or tasks for service items, and that may be a simpler way to achieve the same thing. This is described in more detail here.

8 thoughts on “Automated Actions to create tasks for Sales Order lines

  1. Is there any preparation I have to do in Project App before creating this automation? For some reason I can’t get it to work.

    Like

    1. You need to have created a project in the Project app. In my example I had a project called “Odoo implementation”.

      Do you have an error or is nothing happening?

      Like

  2. Hi

    how about the opposite way. Automatically make a sales order with a service on sales order line by given qty. from task?

    Example.

    I have task on project already, and given a qty from a field. THen by button / action like to create sales order automatically with a given service and that qty.? I know ODOO project standard can do something similar. But i need it more specific.

    Like

    1. Not sure whether that is possible. It’s more complex because you need to create a Sales Order and a Sales Order line. It may go beyond what Automated Actions are supposed to be used for. It should be fairly straightforward for a developer to copy the existing logic and amend it to meet your requirements.

      Like

  3. Hi,
    when I create a sale.order and corresponding sale.order.lines via Odoo UI in status draft and confirm them tasks may be created based on a condition on the product in the sale.order.line. That works perfectly fine.
    When I create s same sale.order and sale.order.line with the same data via API and confirm it ALWAYS some taks on a project named “INTERNAL” are created which is not supposed to happen. Somehow the behavior for task creation seems differently depending on creation via UI or API. Looking at the persisted data I cannot find any difference except from the user who created the record. Do you have any suggestion where the taks on the project INTERNAL may come from? I cannot find any automation for this.

    Like

    1. Odoo does process uploaded orders differently. Some actions that are triggered when creating through the UI are not triggered with an upload. This can cause problems!

      Like

      1. Thanks Chris! But how can I find out which actions are triggerd when creating through an upload? If I just could identify the action I could remove it..

        Like

      2. You will need someone who can look at the Python code to check. It would be really useful if this was documented somewhere!

        Like

Leave a comment