Skip to Content

Sales Order Automations (Part One): How to Customize Odoo Sales Order Workflow


Odoo's modularity and flexibility make it a powerful ERP solution, but sometimes business processes require specific customizations. One such case is automating the sales order workflow to fit a company's unique needs. In this post, we will explore how to use Automated Actions to customize Odoo’s Sales Order workflow without modifying the core code.


Why Use Automated Actions?

Automated Actions in Odoo allow businesses to trigger specific operations based on conditions. Instead of writing custom modules, Automated Actions can help streamline processes such as:

  • Sending automated email notifications when an order reaches a specific stage
  • Updating order fields dynamically
  • Automatically confirming orders based on certain conditions
  • Restricting actions unless specific criteria are met


Example: Auto-Confirm Sales Orders for Specific Customers

Let's say we want all sales orders from a VIP customer category to be automatically confirmed upon creation. Here's how we can achieve this with Automated Actions:


Step 1: Navigate to Automated Actions

  1. Activate Developer Mode. Not sure how? Click here.
  2. Go to Settings > Technical > Automated Actions 
  3. Click Create to define a new automated action.


Step 2: Define Basic Settings

  • Model: Sales Order (sale.order)
  • Trigger: On Creation
  • Apply On: Use a domain filter to target VIP customers. Example:
    [('partner_id.category_id.name', '=', 'VIP')]
  • Action To Do: Execute Python Code


Step 3: Add Python Code

To confirm the sales order automatically, add the following Python code snippet:

if record.state == 'draft':
    record.action_confirm()


Step 4: Save and Test

Create a new sales order for a VIP customer, and it should auto-confirm upon saving.


Conclusion

Using Automated Actions in Odoo, businesses can significantly optimize their sales workflow without modifying core code. This approach ensures smooth upgrades and minimal maintenance while still providing powerful automation.

Want more Odoo customization tips? In part two we will introduce email notifications to notify the sales team. Stay tuned!

Unleashing the Power of Odoo: A Guide to Developer Mode (and Why You Should Tread Carefully)