Skip to main content

Copying data from the header to the document item

Copy field on an item and when previousValue is needed

Written by Petr Pech

The document item takes over part of the data from the header — accounts, VAT lines, cost center, contract, or tags. This is controlled by a set of logical fields starting with kop.


Fields for copying

Field

What is copied from the header

kopZklMdUcet, kopZklDalUcet

Base accounts (debit and credit).

kopDphMdUcet, kopDphDalUcet

VAT accounts (debit and credit).

kopTypUcOp

Posting template.

kopClenDph

VAT line.

kopClenKonVykDph

VAT control statement line.

kopStred, kopCinnost, kopZakazku

Cost center, activity, contract.

kopKlice, kopDatUcto, kopEkokom

Tags, posting date, Ekokom report.

All fields are writable and are set directly on the document item:

{
"winstrom": {
"faktura-vydana": {
"id": "123",
"polozkyDokladu": [{
"id": "456",
"kopClenDph": "false"
}]
}
}
}

💡 If the item has a posting template filled in, a simple change of these fields may not take effect — the values are tied to the calculation from the template. In that case, add the previous value, which triggers the change response: "kopClenKonVykDph@previousValue": "true". The principle is described in the article Updating amounts when the exchange rate changes.


Related

Did this answer your question?