Magento's stock system for multiple locations (MSI) only lowers stock when an order is shipped in Magento, and Business Central never does that today. This page explains the problem, what Vendic builds for it, what we propose for products sold without stock, and how we test it. For Miedema, and for the developer who guides the tests. Please review it before we estimate the module.
Each location has its own physical stock. What the shop shows as available is that stock minus open reservations. Example: Leeuwarden has 10, a customer orders 5.
The reservation only disappears with a shipment, cancellation or credit memo in Magento. An order finished somewhere else keeps its reservation.
Orders are handled in Business Central and Magento never gets a shipment. With MSI on, every order would keep its reservation. Illustration of one product over twelve weeks:
Nvision already sets the status "ERP processing" in Magento once an order is in Business Central, and Miedema handles every order that lands there. A Vendic module reacts to that status and ships the order in Magento. The reservation lives about a minute, and Nvision does not need to build anything.
When Magento ships, it takes the quantity off one location. If that location has less than the shipped quantity, Magento refuses the whole shipment: Not all of your products are available in the requested quantity. Our module works around this in two cases.
The product physically comes from Leeuwarden for the pickup, so the stock comes off Leeuwarden.
Miedema sells several products with stock 0, mainly the Keralit range, and wants to sell more of them next year. Allowing backorders lets the customer order them, but Magento still refuses to ship them:
For products that Miedema sells without stock, Magento stops tracking stock ("Manage Stock: No"). The module then simply leaves them out of the shipment. That is no problem: there is no stock to take off, and Magento ignores stock for these products, so nothing gets stuck in the shop. The rest of the order ships normally.
| Order | Stock | Standard Magento | With the Vendic module |
|---|---|---|---|
| Pickup Heerenveen: 2 × A | A: Heerenveen 5 | ships | 1 shipment · Heerenveen |
| Pickup Heerenveen: 4 × B | B: Heerenveen 0, Leeuwarden 30 | fails | 1 shipment · Leeuwarden |
| Pickup Heerenveen: A + B | as above | fails | 2 shipments · both locations |
| Delivery: 4 × B | B: Leeuwarden 30 | ships | 1 shipment · Leeuwarden |
| Any order: 3 × D Keralit | stock management off | fails with backorders | left out, no error |
miedema-feature-miemw-155-msi-6b0560b306f68.vendic.cloud. Miedema connects the Business Central test company to it. Vendic sets up the two locations and, once built, the module.Test products: A in stock in both locations, B only in Leeuwarden, D a Keralit product with stock management off.
| Test and what to do | Expected | Who | |
|---|---|---|---|
| 1 | Stock per location BC sends stock for A, B and D. | Magento shows the right quantity per location for A and B. | Miedema |
| 2 | Delivery order Order 5 × A. Nvision brings it into BC and sets the ERP status. | Within minutes: one shipment from Leeuwarden, stock Leeuwarden −5, nothing reserved, no e-mail. | Miedema with André |
| 3 | Stock update after shipping BC sends stock again while the order from test 2 is still in the building. | Available stock does not go back up by 5 (no double sale). | Miedema |
| 4 | Pickup Heerenveen, in stock there Order 2 × A for pickup Heerenveen. | One shipment from Heerenveen. | Miedema with André |
| 5 | Pickup Heerenveen, only in Leeuwarden Order 4 × B for pickup Heerenveen. | One shipment from Leeuwarden (the transfer), no error. | Miedema with André |
| 6 | Mixed order Order A + B for pickup Heerenveen. | Two shipments: A from Heerenveen, B from Leeuwarden. | Miedema with André |
| 7 | Not enough in Heerenveen Order more A than Heerenveen has. | The shortfall ships from Leeuwarden, or a clear alert. Result decides the final rule. | Miedema with André |
| 8 | Product sold without stock (Keralit) Order D, alone and together with A. | D is not shipped and causes no error; A ships normally. | Miedema with André |
| 9 | ERP status sent twice Nvision sends the status again for an order from test 2. | Nothing happens: no second shipment. | André |
| 10 | Sale in the store Lower the stock of A in BC without a web order. | Magento follows after the next stock update. | Miedema |
| 11 | Cancellation Cancel an order in BC after Magento shipped it. | Stock follows BC; what the customer sees is acceptable. | Miedema |
| 12 | Payment methods One test order per payment method (iDEAL, on account, others). | No unexpected capture or payment error after the automatic shipment. | Miedema with André |
André already knows this shipping logic per location from another Vendic shop and guides the tests.
MIEMW-155, pull request Vendic/miedemabouwmaterialen#503: MSI modules enabled in app/etc/config.php, data patch InitializeMsiFromLegacyStock. Up to date with development on 24 Nov. Preview built with build-minimal (anonymised 30-day dump of 22 Nov); login in the PR comment. Keep the PR open: a rebuild changes the preview URL.Vendic_InventoryShipping from another Vendic client repository (search the org for Vendic\InventoryShipping).https://api.commerce365.io, B2B pricing on, direct BC web service off.magento/inventory: SourceDeductionService::execute() throws when sourceQty − qty < 0 and skips items with Manage Stock off. PlaceReservationsForSalesEvent places reservations for every SKU of a stock-managed product type, so also for products with Manage Stock off.ShipOrder logic, notify=false, no invoice. Source per item from a preference based on the order: delivery → Leeuwarden only; pickup → pickup location, then Leeuwarden. Replace the global source priority in GetSourceForOrderItems with this.Plugin\AllowShipmentFromOutOfStockSourceItems: it hooks a third-party algorithm Miedema does not have.ShippingMethodsFilterBySource and StockPicker modules from another Vendic shop do this on the frontend). Part of the shop-side work after the tests.bin/magento indexer:reindex inventory, bin/magento queue:consumers:start <module consumer> --max-messages=100 and the inventory consumers (for example inventory.reservations.updateSalabilityStatus).SELECT sku, SUM(quantity) FROM inventory_reservation GROUP BY sku (0 for shipped stock-managed SKUs).