Fix some processes of work orders.

- Validate properly, the 'quantity' widget in work order item editor;
- Before try to close a work order(without a sale), check if all items
were reserved;
- Add tests.

Change-Id: Ib35bdfc4eb4638aac3fd1f0340c1e2017ba91d0e