Skip to Content

The one about the Project, Sequences and Automation Rule

When you’re managing multiple projects in Odoo, things can get messy—fast. One of the simplest ways to keep order is by giving each project a unique, structured ID or code using a sequence. But here’s the magic part: you don’t have to assign these manually.

Thanks to Automated Actions, you can generate custom project sequences in Odoo without writing a single line of code.

In this guide, we’ll walk through how to set up a custom sequence for your projects that automatically triggers whenever a new one is created. No manual input. No developer needed. Just smart automation.

Why Use Sequences for Projects?

A custom sequence (like PRJ0001, PRJ0002, etc.) can help:

  • Easily reference projects in reports or emails.
  • Avoid duplicate or confusing names.
  • Create a consistent format across departments.
  • Improve search and filtering.

What You’ll Build

By the end of this tutorial, you’ll have:

✅ A sequence format like PRJ0001 for each new project

✅ An Automated Action that auto-applies the sequence on project creation

✅ A setup you can tweak for other models (Tasks, Leads, etc.)


Step-by-Step: Creating an Automated Action for Project Sequences


Step 1: Activate Developer Mode

  1. Go to the top-right menu under your name or company logo.
  2. Click "Settings" → Scroll down.
  3. Click "Activate Developer Mode."


Step 2: Create a New Sequence

  1. Go to Settings → Technical → Sequences & Identifiers → Sequences.
  2. Click Create.
  3. Fill in the form as follows:
FieldValue
NameProject Sequence
Codeproject.sequence
PrefixPRJ
Padding4
Next Number1

💡 This setup will generate codes like PRJ0001, PRJ0002, etc.


Step 3: Add a Custom Field (If Needed)

If your Project model doesn’t already have a sequence field:

  1. Go to Studio (top-right wrench icon on Project module).
  2. Drag a Char field onto the form.
  3. Label it Project Code or Project ID.
  4. Set its technical name to sequence.


Step 4: Create an Automated Action

  1. Go to Settings → Technical → Automated Actions.
  2. Click Create.

Now configure the action:

FieldValue
NameAuto Project Sequence
ModelProject
TriggerOn Creation
Action To DoExecute Python Code

if not record.x_studio_sequence:

    record.write({

       'x_studio_sequence' : env['ir.sequence'].next_by_code('project.sequence')

   })


Step 5: Test It!

Now create a new Project:

  1. Go to Project → Create.
  2. Enter a name and save.

Boom. 🎉 You’ll see a unique project code (like PRJ0001) automatically filled into the custom field.

With just a few clicks and one smart automated action, you've added a layer of order, automation, and professionalism to your project workflow in Odoo.

Automating sequences like this isn’t just about looking good—it’s about building scalable, error-free systems.

So next time your projects start piling up, remember: Odoo automation has your back.

Archive