Introduce Order Status Workflow/Permissions for Vendors

Hi all

I need to limit the number of statuses the vendors can see in their admin area for each order. I was expecting this to be very basic functionality out of the box but it seems that there is nothing and vendors can just change order statuses as they please.

The reason for needing this is that, apart from being confusing to vendors seeing all the statuses they don’t need, allowing vendors to change statuses can lead to some very odd situations and even mean that we end up losing money. e.g. a vendor can just simply change an order back and forth between statuses and end up with ‘Dispatched’ just before we make the payouts and hence get paid for the order, even though it was an order that was Cancelled and we had refunded the money.

So in short, I need to modify the code to provide some sort of state-machine or similar so that for each order, only a few status options are available to the vendor based on the current state of the order. e.g. if it’s Pending, they should only see ‘Dispatched’ or 'Cancelled. Similarly if it’s ‘Dispatched’, this needs to be an end state and no further changes of status should be available to the vendor, and so on.

Anyone has any suggestions of what the best way of achieving this is? (e.g. should we keep the state in a new db table, or just modify certain files and hardcode there etc)

Any input will be really appreciated.