Commit Graph

5 Commits

Author SHA1 Message Date
Lucas Perais (lpe) 46263eb398 [FIX] stock: backport fix negative quants
Original commit (in 10.0) be9dce625c55e1b2d6039573c7035d61f762edc8

From original commit:
It is still possible to have negative and positive quants in the same
location because of returns: if you send something to the customer that
is not there and you return it, you will still be able to reserve the
returned goods to send to another client.

Before, if you would do an inventory adjustment, it would not take into
account these returned quants and their negative counterpart, which made
them difficult to get out of the system.

This fix takes them into account by creating two movements for one
inventory line: move the positive counterpart to the inventory location
before getting back from this location the same quantity.

This way, even if you have 0 as quantity on hand but you have those 2
quants, it will eliminate them. (if you are increasing the stock, part
of the process might have done it automatically already).

Also, a key of context has been added which authorizes the process described above in the case of both a tracked product and no lot_id on the stock inventory

OPW 743107
Closes #17167
2017-06-15 08:42:57 +02:00
Josse Colpaert 1de37862d6 [FIX] stock: when matching moves with pack operations through quants, it did not match the packages correctly. Courtesy of Pedro Baeza
Before, it did a search to see if the package existed,
but the only thing it needs to do is see if the package
on the pack operation corresponds to that of the quant.  (no need to check children also)

There is a test added:
A picking with 120 pieces incoming, 120 in pack 1, 80 in pack2
When we deliver those in a picking out, with product pack operations: (by taking them out of the pack)

120 from pack 1 and 80 from pack2,
we should only have 2 quants and links between moves in the end

And before, it generated 3 because it matched the wrong quants and made the wrong links.

opw 693760 closes #13836
2016-11-16 11:26:20 +01:00
Josse Colpaert 09abac7608 [FIX] Stock: Make sure inventory works with packs and lot = False
The inventory should work with packs.  If a pack is not indicated
in the inventory line, it means we correct the quantity for the product
that is not in a pack.

Also, when the lot is False, it should not behave as normal stock moves.
It should correct for the quantity that has no lot.

We try to reconcile the negative quants in the pack also.
2015-03-13 12:11:17 +01:00
Josse Colpaert 88169ec625 [FIX] Dozen / Ton spelling
Closes #4554
2015-01-06 17:21:41 +01:00
jir 6c23a9ca19 [ADD] Test cases of stock in new api. 2015-01-06 17:05:11 +01:00