Skip to main content

Transfer to Another Warehouse After Issuing Goods from a Received Order Using REST API

How to transfer stock to another warehouse in the REST API after goods have been issued upon fulfillment of a received order

Written by Petr Pech

A standard transfer between warehouses (transfer order) in ABRA Flexi always has two sides — issue and receipt. Its typical creation is described in the article Transfer order - REST API. This guide addresses the situation where the issue note was created by fulfilling an order, meaning it cannot be completed as a standard transfer order.


Scenario

The system contains a received order for goods from a customer. The goods need to be issued from one warehouse and only later, in a second step, transferred to another warehouse — that is, completing a transfer order.

This procedure is not possible by default. Fulfilling an order via a stock movement sets the issue note's movement type to Issue after order, and completing the transfer order via the API then fails with error correctDoklTypeNotFound.


Solution

1. Fulfilling the order via stock movement

First, we generate an issue note from the order. Details can be found in the article on order fulfillment; here we only provide an example:

POST https://demo.flexibee.eu/c/demo/objednavka-prijata.xml
<?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>

The created issue note has the movement type typPohybuSklad.vydejPoObch:

<?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>

⚠️ The response to the fulfillment contains the order ID, not the newly created issue note's ID. You can find its identifier through the document's linked records:
GET /c/{firma}/objednavka-prijata/{id}/vazebni-doklady.json

2. Enabling the movement type change

The movement type Issue after order blocks completion of the transfer order, so we need to change it. This can be enabled via advanced parameterization — parameter zmenaPohybuRealizace (Allow changing the movement type detail on an issue/receipt note created from an order/invoice):

POST https://demo.flexibee.eu/c/demo/parametr.xml
<winstrom version="1.0">
<parametr>
<paramK>zmenaPohybuRealizace</paramK>
<hodnota>true</hodnota>
</parametr>
</winstrom>

Without this parameter, editing the issue note returns 400 with code valueCannotBeChanged and the message The value of property 'typPohybuSkladK' ("Movement type + detail") cannot be changed from 'typPohybuSklad.vydejPoObch' to 'typPohybuSklad.vydejPrevod'.

3. Editing the issue note

Now the correct movement type and target warehouse can be set on the issue note. For a transfer order, this is typPohybuSklad.vydejPrevod:

POST https://demo.flexibee.eu/c/demo/skladovy-pohyb.xml
<?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>

For completeness, here are all the issue movement types; the full list, including the receipt values, can be found in the description of the skladovy-pohyb record.

Value

Movement type

typPohybuSklad.vydejHoly

"Plain" issue

typPohybuSklad.vydejPolot

Issue of semi-finished product

typPohybuSklad.vydejPoFak

Issue after invoice

typPohybuSklad.vydejPoObch

Issue after order

typPohybuSklad.vydejPrevod

Issue for transfer order

typPohybuSklad.vydejProFakCenik

Issue for invoicing (prices from price list)

typPohybuSklad.vydejProFakRucne

Issue for invoicing (prices entered manually)

typPohybuSklad.vydejVyrob

Issue of finished product

typPohybuSklad.prijemVydejVratka

Issue (credit note, return)

4. Completing the transfer order

Everything is now ready to complete the transfer order from the order-generated issue note in the standard way — using the action dokoncit-prevodku:

POST https://demo.flexibee.eu/c/demo/skladovy-pohyb.xml
<?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>

The 201 response contains the ID of the issue note on which you ran the action. The receipt note created in the target warehouse can again be found among the linked documents.


Failed requests

Situation

Response

Action dokoncit-prevodku run on an issue note that still has the type Issue after order

400, correctDoklTypeNotFoundFailed to find the correct document type.

Changing the movement type without the zmenaPohybuRealizace parameter set

400, valueCannotBeChanged

Action dokoncit-prevodku run on a receipt note

400, skladGenerPrevodkaNejdeZPrijemkyThe receipt note for the transfer must be created from an issue note.


FAQ

Will the documents be linked?

Yes. The received order, the issue note, and the receipt note in the target warehouse all remain linked — all three documents are returned by a query on the order's vazebni-doklady.

Does the parameter need to stay enabled permanently?

No. The parameter only allows the movement type change, so it only needs to be enabled at the moment you edit the issue note.


Related

Did this answer your question?