Here's the sequence of calls with partial relevant payloads using scenario similar to original post but with quantity of 20. 1. Get balance from Visma: GET /inventorysummary/1007 [{ "inventory": { "number": "1007"}, "warehouse": {"id": "1 "}, "location": {"id": 147}, "available": 20, "availableForShipment": 20, "onHand": 20, "baseUnit": "STYCK", }] 2. Decrease balance in Visma to zero: POST /InventoryIssue { "date": {"value": "2023-08-28T06:41:04.5923895+00:00"}, "hold": {"value": false}, "description": {"value": "Stock take"}, "externalReference": {"value": "Stock take"}, "issueLines": [ { "warehouseId": {"value": "1"}, "unitCost": {"value": 0}, "tranType": "Issue", "operation": "Insert", "lineNumber": {"value": 1}, "inventoryNumber": {"value": "1007"}, "locationId": {"value": "1"}, "quantity": {"value": 20}, "reasonCode": {}, "description": {"value": "Stock take"} } ] } Response: { "totalAmount": 360, "controlAmount": 360, "issueLines": [ { "transactionType": "Issue", "warehouse": { "id": "1 ", "description": "Huvudlager" }, "unitCost": 0, "extCost": 0, "unitPrice": 18, "extPrice": 360, "project": { "id": "X", "description": "Non-Project Code." }, "lotSerialNumber": "", "allocations": [ { "lineNbr": 2, "location": { "id": "1", "name": "Standard" }, "lotSerialNumber": "", "quantity": 20, "uom": "STYCK" } ], "lineNumber": 1, "inventoryItem": { "number": "1007", "description": "Item 1007, Green" }, "location": { "id": "1", "name": "Standard" }, "quantity": 20, "uom": "STYCK", "description": "Stock take", "branchNumber": { "number": "1", "name": "Bitlog Nordic AB TEST" } } ], "referenceNumber": "1800055", "status": "Balanced", "hold": false, "date": "2023-08-28T00:00:00", "postPeriod": "202308", "externalReference": "Stock take", "description": "Stock take", "totalQuantity": 20, "controlQuantity": 20, "lastModifiedDateTime": "2023-08-28T08:41:06.587", "branchNumber": { "number": "1", "name": "Bitlog Nordic AB TEST" }, "metadata": { "totalCount": 1, "maxPageSize": 1000 } } 3. Releasing: POST /InventoryIssue/1800055/Action/Release Response: {"actionId":"2f8eef46-2d12-420c-a078-5f6c09611c21","actionResult":"InProcess"} This is where processing of our first transaction completes and the second transaction gets processed short after. 4. Get balance from Visma: GET /inventorysummary/1007 [{ "inventory": { "number": "1007"}, "warehouse": {"id": "1 "}, "location": {"id": 147}, "available": 0, "inIssues": 20, "onHand": 20, "baseUnit": "STYCK", }] Note that OnHand is still 20 and this is what we compare our balance to and adjusting it in Visma if needed. There is no difference between out two systems (20 vs 20), so we don't perform any actions. Had we made the same call in a couple of seconds, Visma would release the issue and OnHand would be zero. Thus my suggestion was to include InIssues in calculating the balance. The only problem I've encountered with that is that sometimes I've seen issues not being released if they were incorrect, thus balance will still get out of sync. Cheers, Oleg
... View more