A standard transfer between warehouses (stock transfer) always has two sides in ABRA Flexi — an issue and a receipt. You can find the standard way to create a stock transfer via the REST API here.
Scenario
There is a sales order received from a customer for goods in the system. These goods need to be issued from one warehouse, and then in a second step (at a later point) the goods need to be transferred to another warehouse — i.e., the stock transfer needs to be completed.
This procedure is not possible by default. Fulfilling an order via a warehouse movement sets the movement type on the issue document to "Issue by order", so completing the stock transfer via the API results in the error Failed to find the correct document type.
In this guide, we will look at how to resolve this situation.
Solution
The first step is to fulfill the order using a warehouse movement. More information can be found in the documentation above; here we will provide just an example:
<?xml version="1.0"?>
<winstrom version="1.0">
<objednavka-prijata>
<id>code:OBP001/2023</id>
<realizaceObj type="skladovy-pohyb">
<polozkyObchDokladu>
<polozka>
<cisRad>1</cisRad>
<mj>1</mj>
</polozka>
</polozkyObchDokladu>
</realizaceObj>
</objednavka-prijata>
</winstrom>
This API request generates an issue document from the order, which will have the movement type set to "Issue by order". The ID or internal number of this issue document is important for future modification and completion of the transfer:
<?xml version="1.0"?>
<winstrom>
<skladovy-pohyb>
<id>123</id>
<kod>S-001/2023</kod>
...
<typPohybuSkladK showAs="Výdej po objednávce">
typPohybuSklad.vydejPoObch
</typPohybuSkladK>
...
</skladovy-pohyb>
</winstrom>
Application parameterization
Our goal is to allow this movement type to be changed, as it blocks the completion of the stock transfer. A solution exists via advanced parameterization of the application, which allows us to change the movement type on warehouse movements. The parameter in XML looks as follows:
<winstrom version="1.0">
<parametr>
<paramK>zmenaPohybuRealizace</paramK>
<hodnota>true</hodnota>
</parametr>
</winstrom>
Editing the issue document
This parameter enables the ability to change the movement type on the issue document. Once the parameter is installed, you can update the issue document to the correct movement type and set the target warehouse. For completeness, the possible movement types are listed below. More information can be found in the description of the skladovy-pohyb record.
"Plain" issue - typPohybuSklad.vydejHoly
Semi-finished product issue - typPohybuSklad.vydejPolot
Issue by invoice - typPohybuSklad.vydejPoFak
Issue by order - typPohybuSklad.vydejPoObch
Issue for stock transfer - typPohybuSklad.vydejPrevod
Issue for invoicing (prices from price list) - typPohybuSklad.vydejProFakCenik
Issue for invoicing (prices entered manually) - typPohybuSklad.vydejProFakRucne
Finished goods issue - typPohybuSklad.vydejVyrob
Issue (credit note, return) - typPohybuSklad.prijemVydejVratka
<?xml version="1.0"?>
<winstrom version="1.0">
<skladovy-pohyb>
<id>123</id>
<typPohybuSkladK>typPohybuSklad.vydejPrevod</typPohybuSkladK>
<skladCil>code:SKLAD CÍL</skladCil>
</skladovy-pohyb>
</winstrom>
Completing the stock transfer
Everything is now ready to complete the stock transfer from the order-generated issue document using the following standard method via the "dokoncit-prevodku" action:
<?xml version="1.0"?>
<winstrom version="1.0">
<skladovy-pohyb action="dokoncit-prevodku">
<!---jako ID lze použít i interní číslo výdeje pro převod-->
<id>123</id>
</skladovy-pohyb>
</winstrom>
FAQ
Will the documents be linked?
Yes, all documents — the sales order, the issue, and the receipt — will be linked together.
Do you need help?
If you have any questions about the application, please contact us at podporaflexi@abra.eu or via the chat window in the bottom right corner.
