Forbid negative quantities when closing stock period

Tryton allows to have negative quantites of stock, which we expect to be fixed latter by the user.
For example, if the user is shipping a product which supplier shipment is not yet introduced on the system, the negative quantity will be fixed when the supplier shipment is introduction.

As at some point we expect to fix, I’m wondering if we should prevent to close a stock period with negative quantities for some grouping. This will raise the alarm for the user that was not aware that there where negative quantities, so we force them to fix them.

Does it sound reasonable?

For consumable product it is expected to have negative quantities.
Also some location type like the supplier is also expected to have negative quantities.
So I would make only a warning and check only for storage location and for non-consumable product.

Yes, that makes sense.

I’m wondering which is the benefit of the warning. As we are just checking storage locations it is not phisically possible to have a negative quantity, so this is for sure an error that should be fixed.

Using an error instead of a warning will force the user to fix the value instead of delaying the fix to the future.

If the warning is skipped and there is quantity update for the product, the warning will re-raise on the next stock closings.

I consider this similar to the validation of inactive accounts when closing a period.

Please note that there are scenarios where it is possible to have negative quantities that cannot be fixed at the moment of closing a stock period.

Some customers have several locations and the responsible of closing stock period may be a different person than the responsible of updating stock values in a warehouse. Then, it may be desirable to close a stock period with negative quantities.

There may be products that are acquired in non-exact or very large quantities, like grain or seeds. In that case, fixing stock issues may not be straightforward.

So for me, this feature should be configurable by location.

why does it matter ?

But user is not required to fix at the precis day it happened.

Users are free to do what ever they want. Also I’m not sure that many will fix right away (he may not have enough information to fix it) but indeed they will just not close the period.

Yes this will be a good behavior to keep user warned about the problem.

For me it is not at the same level as for accounting there is no return back if the fiscal year is locked.

I do not see the point to make a configuration. It is always better to have non-negative value but as long as we just have a warning that user may skip, we do not prevent to close the period.

It is not required if we have a warning. If the system blocks period closing, though, it should be necessary some configuration.

Then it’s just a mather of asking the right person to fix the quantities before doing the closing.

Ok that make sense for me, so a warning should work for all cases.

As the quantities are used for the stock valuation (which affect accounting), I think it’s a good practice to make the user aware that there is something to be fixed.

It makes more sense with Add wizard to account the stock valuation because we require the user to close the stock period before creating the right stock moves.