Improve Supply Stock UX

The computation of Supply Stock can take quite some time and its UX could be improved. Currently it is implemented as a Wizard which:

  • Makes the user wait until the process finishes, blocking any other operations
  • Each step of the wizard does its own checks (such as checking if there are old productions or old customer shipments). This means that after computing the productions (which can already take some time) the user will see a Warning saying there are old Customer Shipments, making the computation process start over again.

So I propose to keep the wizard but:

  • We group the checks in a single method that is executed at the very beginning. The stock_supply_production can override it and its own checks.
  • Only after all those checks have passed the computation starts in a queue, so the last step of the wizard tells the user to wait until she is notified.

Any problems with such proposal? Better ideas?

For me this is not true. The warnings are all done in transition_create_.

The main problem is that user will not be warned if there is any problem.

Maybe running the wizard in a tab will be better to let user switch.

You’re right. It took so much time to get some of the warnings that I took for granted that the checks were being done later.

Taking a quick look at the code I realize that there are several simple optimizations:

1 Like

What problems do you envision?

The fact that there can be problems can happen with any task in the queue so I think that we must ensure that any issues that may happen always get to the user.

I don’t think anything prevents us from sending a notification to the user saying there was this or that problem durint the execution.

I do not know but any of the generate_ functions can be extended to raise an error.

We use the queue only for repeatable (aka “idempotent”) tasks without side effect. So if there are an error on a task, it is only logged as error.
So currently we always provide another way to run the task in foreground (like the process button on sale/purchase order for the administrator).
For me, it is better to have a running tab than a background task that user may forget about and which may not see the notification.