Skip to main content

API - Updating the Document Series on a Document

How to update the internal document number to a different value based on the document series

Written by Vývojář ABRA Flexi

If you change the document type on a document, a different document series usually belongs to it. Whether the internal number is regenerated depends on what you send along with the type.


When the number is regenerated

What you send

Result

Only the new typDokl

The internal number is regenerated according to the new type's series.

typDokl and a custom kod

Your code is used, the number is not regenerated.

typDokl, kod, and typDokl@previousValue

The change reaction is triggered and the number is regenerated according to the series — the submitted kod is overwritten.

So, if you want to be sure that the document receives a number from the new type's series, send the previous value:

{
"winstrom": {
"faktura-vydana": {
"id": "20",
"typDokl": "code:FAKTURA",
"typDokl@previousValue": "code:ZÁLOHA"
}
}
}

ℹ️ The previousValue attribute triggers the change reaction — the same logic that runs when you make a manual change in the application. It works the same way for the exchange rate, price, or company link; the principle is described in the article Updating amounts when the exchange rate changes.

⚠️ The document type changes together with the document series, so the numbering changes as well. If you have the document number linked in another system, keep in mind that it will differ after this operation.


Related

Did this answer your question?