Bank import — finalising, storno, skipping, deletion
The steps from staged items to a document, duplicate protection and the import row balance match, the rules of storno and skipping, and the rights.
Finalising (final, finalizerow) builds a bank document (transaction header + items) from the staged items, settles the invoices' outstanding balances and sets the row to Booked. A row becomes booked only if at least one live document belongs to it and its balance matches.
Finalising (finalizeAllStagedTransactions())
- Processes every (or one) status-1 row by value date, in a database transaction.
- Duplicate protection: if the row already has a live document, it is skipped.
- Header + items from the staged items; number in the form
account-direction-sequence(finance/transaction::nextTransactionNo, otherwise theIMP-prefix with the row ID); value date, statement number, opening and closing balance. - The invoice outstanding balance is settled; payment order items become “bank settled” (
paymentorder::markItemsBankSettled); a cross-client mirror draft is created; the partner bank account is linked to the partner. - Finally the import row balance is compared with the documents (
importRowBalance()); on a mismatch it rolls back. On success the row is Booked. - Per-row database errors in the response (
error_finalize_row).
Storno (stornorow)
Deletes the row's documents with finance/transaction::deleteTransactionWithRollback() (outstanding balances are restored); if there is no document (orphan row), it sets the row to New. Blocked for a finalised (status 1) document: reset it to draft in the document module first.
Skipping and deletion (delete)
skip: sets the row to status 5 (staged items deleted); called again 5 → 0.delete: physically deletes the RAW row and its staged items; the template has no button for it.- A Booked (2) row cannot be skipped or deleted.
Data model
Table names carry the installation's own prefix in the database: transaction, transaction_item, transaction_settlement, invoice, transaction_import_row, transaction_import_staged, payment_order_item, bankaccount (balance).
Permissions
final+ coremodify:final,finalizerow,stornorow.finalizerowandstornorowcheck content scope (the company resolved from the row'sowner_accountmust be allowed); the bulkfinalhas no content scope.delete+ coremodify:skip,delete.- None of the keys is in the catalogue seeds.