-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packaging fails if multiple stock locations are required to fulfill quantity #583
Comments
Great find. The 2.4 breakage you're talking about would be this commit from this pull request right? I'm going to go back and try to understand the old code better but it does seem like something fundamental needs to change here. |
@jhawthorn @jordan-brough I made this commit with @DanielePalombo on a solidus fork branch. This solves splitting across multiple stock locations. Anyway I'm afraid this generates 2 ready packages, not identical, since with this logic what's inside the first package cannot be inside the second one. At a first look this makes Also, at the moment A couple of crazy ideas to solve this:
I'd love to hear some feedback before trying to go in one of the above directions. |
i'm not sure about removing |
Discovered this while writing tests for #566.
Because of the way the Stock Coordinator, Packer and Prioritizer work, it won't properly split inventory across stock locations if multiple locations are required to fulfill the quantity of a variant (ie. no stock location has the full amount requested, but combined they do). I believe this was a regression in spree 2.4
Example scenario
Consider packaging an order with 2 of the same variant. In this example we have two stock locations, each with 1
count_on_hand
of the variant.Stock::Coordinator
we have two unallocated_inventory_units, we'll call themunit1
andunit2
.Sock::Packer
is made for each stock location to generate the candidate packages. They both create the identical package, containing onlyunit1
. Neither containsunit2
because each only has enough stock for one.Stock::Prioritizer
removes the unit from the second candidate package and then removes the empty package entirely.Stock::Coordinator
finally returns a single package with the single inventory unit.The text was updated successfully, but these errors were encountered: