How to Unlock the Locked Sales Order?

without creating addon with Server Action

vITraining Admin

Use Odoo's Server Action solution!

Go to Server Action menu under Settings, first enable the developer mode...


Add new Server Action called Unlock SO.

Select Base Model: Sale Order

Select Action to Do: Execute Python Code

Type the code below under Python Code tab:


if env.context.get('active_model') == 'sale.order' and env.context.get('active_id'):
    model.browse(context['active_id']).write({'state':'sale'})


Then click the Add in the 'More' menu..


Done!


The menu will appear in the Sale Order form, Action Button -> Unlock Order for you to unlock the locked SO.