Skip to main content

Generating write-offs via API

Example of Asset Depreciation Generation via API

Written by Petr Pech

Asset depreciation can be generated via the API using the generuj-odpisy action. This action doesn't run on a single record, but on a group defined by a filter.


Request

<winstrom version="1.0">
<majetek filter="id gt 0" action="generuj-odpisy"/>
</winstrom>

The filter can be narrowed down to a specific asset, for example filter="kod = 'ABP-1'". The generated depreciation entries will appear in the asset's linked records:

GET /c/{firma}/majetek/{id}.xml?relations=danove-odpisy,ucetni-odpisy&detail=full

⚠️ Generation will fail if the period to which the depreciation belongs is locked — in that case, the error will read Nepodařilo se změnit odpis, protože období (…) je zamčeno. The same applies to a locked asset record (Záznam je zamčený). Period locking is covered in the article Locking Periods via REST API.

ℹ️ For a single asset record, only the actions delete, lock, and lock-for-ucetni are available via actiongeneruj-odpisy is only used together with a filter.


Related

Did this answer your question?