Skip to main content

Cancelling Issued Invoices via XML Takes an Unreasonably Long Time

Document cancellation is not stopping, but it is taking a very long time. This is due to database triggers.

Written by Petr Pech

This procedure can only be performed on server-based / local installations where you have access to the database. Immediately after completing this procedure, the triggers must be reactivated.

The cancellation of documents does not stall, however it takes a very long time — this is due to database triggers.


When an invoice is cancelled, the associated stock documents are also cancelled, stock items are removed, and after each cancellation the stock is recalculated.


The solution is to disable these triggers and proceed as follows:

  1. Disable triggers — alter table dpolsklad disable trigger user;

  2. Import the XML file for invoice cancellation

  3. Enable triggers — alter table dpolsklad enable trigger user;

  4. Run stock recalculation

  5. Run account balance recalculation

The last two steps may take several hours!

During these operations, no one should be accessing Flexi — it is advisable to restrict access, including API access. We therefore recommend carrying out this process overnight.

Did this answer your question?