Workflow 1 of 4 · Order release

Order checks before release

Hold Space or Ctrl and drag to move the canvas

n8n workflow JSON

Order checks before release

Paste this into an n8n editor to import the workflow. Credentials and endpoints are placeholders.

{
  "nodes": [
    {
      "name": "Sales order confirmed",
      "notes": "Odoo calls this webhook the moment a sales order is confirmed.",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        300
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "erp/sales-order-confirmed"
      }
    },
    {
      "name": "Get bill of materials",
      "notes": "Reads the bill of materials so every component is known before release.",
      "type": "n8n-nodes-base.odoo",
      "typeVersion": 1,
      "position": [
        220,
        300
      ],
      "parameters": {
        "resource": "custom",
        "customResource": "mrp.bom",
        "operation": "getAll"
      }
    },
    {
      "name": "Get account credit",
      "notes": "Reads the customer's credit position from the contact record.",
      "type": "n8n-nodes-base.odoo",
      "typeVersion": 1,
      "position": [
        440,
        300
      ],
      "parameters": {
        "resource": "contact",
        "operation": "get"
      }
    },
    {
      "name": "Check line capacity",
      "notes": "Asks the MES whether the line has room inside the promised window.",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        300
      ],
      "parameters": {
        "method": "GET",
        "url": "https://mes.example.com/api/capacity"
      }
    },
    {
      "name": "Evaluate three checks",
      "notes": "Combines materials, credit, and capacity into one pass or fail with a reason.",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        300
      ],
      "parameters": {
        "jsCode": "// BOM complete, credit clear, capacity inside the promised window\nreturn items;"
      }
    },
    {
      "name": "All three pass?",
      "notes": "True releases the order; false holds it.",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1100,
        300
      ],
      "parameters": {}
    },
    {
      "name": "Create manufacturing order",
      "notes": "Creates the manufacturing order in Odoo, linked to the sales order.",
      "type": "n8n-nodes-base.odoo",
      "typeVersion": 1,
      "position": [
        1340,
        180
      ],
      "parameters": {
        "resource": "custom",
        "customResource": "mrp.production",
        "operation": "create"
      }
    },
    {
      "name": "Tell planner: released",
      "notes": "Posts the release to the planning channel.",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1560,
        180
      ],
      "parameters": {
        "resource": "message",
        "operation": "post"
      }
    },
    {
      "name": "Hold with one reason",
      "notes": "Keeps the single reason the order cannot start yet.",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1340,
        420
      ],
      "parameters": {}
    },
    {
      "name": "Tell planner: held",
      "notes": "Tells the planner what is blocking the order.",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1560,
        420
      ],
      "parameters": {
        "resource": "message",
        "operation": "post"
      }
    }
  ],
  "connections": {
    "Sales order confirmed": {
      "main": [
        [
          {
            "node": "Get bill of materials",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get bill of materials": {
      "main": [
        [
          {
            "node": "Get account credit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get account credit": {
      "main": [
        [
          {
            "node": "Check line capacity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check line capacity": {
      "main": [
        [
          {
            "node": "Evaluate three checks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evaluate three checks": {
      "main": [
        [
          {
            "node": "All three pass?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "All three pass?": {
      "main": [
        [
          {
            "node": "Create manufacturing order",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Hold with one reason",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create manufacturing order": {
      "main": [
        [
          {
            "node": "Tell planner: released",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hold with one reason": {
      "main": [
        [
          {
            "node": "Tell planner: held",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}