-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Stock movement is doubled #550
Comments
additionally export StockMovementService from vendure/core would be good |
Thanks for the report!
In 0.17.0, there is a new concept of "allocated" (part of the new back-order system #319), which occurs where the current Sales stock adjustment takes place. Allocations occur at the same point (and suffer from the same bug currently). Sales now get created (and therefore stock levels adjusted) only when a Fulfillment is created. Do you think there is still need for being able to define where these 2 stock movement types get created? If so, could you describe a use-case?
|
After reading new feature form 0.17.0 I cannot think of any use case where we would want to change point where sale takes place other than Fulfillment. |
We could then add a new property to the config of a |
Yes, sounds great, though IMHO for full flexibility also to be possible to set any other (custom) order state. |
I did consider that, e.g. |
True, I also meant custom states that might be between payment and shipped, or even before arranging payment (e.g. product reservation without payment/choosing payment) - in that case it should not be property at PaymentHandler, but Order |
Good point on the custom states prior to payment. Maybe we need a if (toState === 'PaymentAuthorized' || toState === 'PaymentSettled') {
data.order.active = false;
data.order.orderPlacedAt = new Date();
await this.stockMovementService.createAllocationsForOrder(data.ctx, data.order);
} |
Great! This way we'll have good default behavior, but also will have option to implement advanced one. BTW the property I see here orderPlacedAt is on Order entity, but is missing in graphql Object type. Could we make it accessible on both admin-api and shop-api? It's handy property for data analytics (e.g. we want to know how many orders been placed in between some dates.). And on shop-api handy for making "Order history" page where will be date of placing the order, not creation. Should I make new feature request for this? |
|
Relates to #550. This commit introduces a StockAllocationStrategy to allow advanced configuration of stock allocation.
Describe the bug
We started tracking inventory and found out that each completed order lowered stock by double the size of actual order contents. I believe this piece of code is to blame:
in order-state-machine.ts
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Should lower the stock exactly to the order.
We should be able to define at which point of an order flow should the inventory movement take place.
Also this code should take in account the direction of the transition - if we revert state transition (e.g. "Processing" to "PaymentSettled" it should not do stock movement neither.)
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: