Lock and Unlock Multiple Sales Orders at Once

Introduction

In the fast-paced realm of business management, every second counts. When you're dealing with a slew of sales orders in your Odoo ERP system, the last thing you want is to be bogged down by the hassle of locking or unlocking them individually. But fret not! This article is your key to unlocking the secrets of how to efficiently manage multiple sales orders with just a few clicks.

The Locking and Unlocking Dilemma

Before we dive into the solution, let's demystify why sales orders are locked in the first place. Sales orders are often locked to prevent unintended changes or alterations once they've been confirmed. This is an essential feature to maintain data integrity and ensure the smooth flow of your sales process. However, there are scenarios where you need to make changes to several locked orders simultaneously, and this is where the real challenge lies.

Lock and Unlocking multiple sales orders at once is like finding a shortcut in a maze.

Mastering Efficiency: Locking Multiple Sales Orders

In Odoo, as it is, you can lock confirmed sales orders automatically. However, if you unlock many orders manually one by one to make some changes and then lock them again one by one.


Let's start by understanding how to lock multiple sales orders swiftly:

Step 1: Access to your Odoo instance

  • Enable developer mode in your DB.



  • Navigate to the 'Sales' module from your dashboard.
  • Click on 'Sales Orders' to access the list of your sales orders.
  • Open Any Sales order in form view  and hover on button in name "LOCK" .
  • You already reached the name of action which we need  "action_done" remember it well.


Step 2: Access the "SERVER ACTIONS".

  • From Home menu open "Settings".
  • Open "Technical" menu from upper menu bar.
  • Scroll technical menu down to reach "Server Actions".


  • From server actions list view click "Create" To Open it in From view mode.


Step 3: Prepare your New Server action

  • Choose suitable name for example " LOCK".
  • From Model drop down list select "sales order".
  • From Action To Do drop down list select "Execute Python Code".
  • Now we will use our action  "action-done" in  for loop to make it Multiple action, copy following code to your server action then "Save".
for r in records:
​r.action_done()


Step 4: Enable your new server action.

  • Click on  "CREATE CONTEXTUAL ACTION ".
  • Refresh your browser by press "F5" on your Keyboard.


Step 5: Access the Sales Orders Module

  1. Navigate to the 'Sales' module from your dashboard.
  2. Click on 'Sales Orders' to access the list of your sales orders

Step 6: Select the Orders to Lock

Now that you're in the Sales Orders module, it's time to choose the orders you want to lock.

  1. In the list of sales orders, use the selection checkbox to mark the orders you want to lock. You can select as many orders as needed.
  2. As you make your selections, the system will highlight the chosen orders.

Step 7: Lock the Selected Orders

With your sales orders selected, it's time to lock many sales orders at once:

  1. Look for an option that allows you to perform a bulk action on the selected orders. This option is typically labeled 'Action' .
  2. From the dropdown menu, select 'Lock' The server action which we already created it before.
  3. Bravo! Your selected sales orders are now locked.


You can use your new action permanently in your need.

Unlocking Multiple Sales Orders with Ease

Unlocking multiple sales orders is just as efficient as locking them. Here's how:

"Use All steps above which we used to  Multiple Lock"


Then replace the previous code with  the following

for r in records:
​r.action_unlock()


FAQs

A1: Yes, you can! In the Sales Orders module, instead of individually selecting orders, simply apply a filter for the status you want (locked or unlocked) and then choose the option to select all. Then, proceed with the locking or unlocking steps as mentioned earlier.

A2: Unlocking multiple sales orders at once is generally safe if you're confident about the changes you're making. However, exercise caution and double-check your selections to avoid any unintended modifications.

Q3: What if I accidentally unlock an order I didn't intend to?

A3: Don't worry; Simply locate the undone action and rectify it.


Conclusion

Mastering the art of locking and unlocking multiple sales orders at once in Odoo ERP is a game-changer for businesses looking to streamline their operations and save valuable time. By following the step-by-step guide provided in this article, you can efficiently manage and modify your sales orders without the hassle of dealing with each one individually.

In the competitive world of business, efficiency is the key to success. Learning how to lock and unlock multiple sales orders at once is just one of the many ways you can boost productivity and stay ahead of the curve.

So, the next time you're faced with a list of locked or unlocked sales orders in your Odoo ERP, remember the shortcuts you've learned here. Efficiency is your ally, and now, you've got the tools to unlock success, one order at a time!


IF you inclined towards visuals, we've got you covered too! Check out our YouTube video demonstrating these efficient techniques for locking and unlocking sales orders in Odoo ERP.

 


Journey doesn't end here!

To stay updated with the latest tips, tricks, and insights on Odoo ERP and business management, subscribe to my newsletter. Be the first to know and stay ahead in the game. Subscribe now for a competitive edge!