Saving a transaction document — validation, settlement, import match

The save steps: amount normalisation, import row match, settlement limit, journal number, shared insert path, read-back, plus cash instalments and opening balances.

Saving a document (finance/transaction.save) calculates the total from the items and records through the shared addTransaction() path. Success is reported only for a document that could be read back.

Save process

  1. Total from the items (thousands separators normalised), also on the currency side.
  2. If started from a bank import row: the row exists and is not booked yet (error_import_row_missing, error_import_row_booked), and the items match the statement line to the fillér (rowAmountParts, importRowBalance; on a mismatch CONFLICT, no save: error_import_row_balance, error_items_sum).
  3. The open balance of settled invoices (HUF and currency) cannot be exceeded (getInvoiceSettleRoom; only invoices in scope): error_settle_over_open, error_settle_over_open_dev, error_settle_over_total.
  4. Journal number (generateJournalNo), addTransaction(), read-back (error_save_not_created).
  5. Link to the import row (attachManualTransaction), settlements (applySettlements).
  6. For a cash HUF register a 5-forint rounding item (LABEL_CASH_ROUNDING).

On edit: editTransaction() + applySettlements().

Related endpoints

EndpointBehaviourRight
cashinstallmentcash instalment on one invoice via addTransaction() (amount at most the open balance), then outstanding recalculationcore modify + edit + scope (invoice client and register company)
settlerate, fxraterate on the payment date from the client's rate source and a preview of the settlement exchange difference (fxSettlementPreview)add or edit + scope
addlabel, removelabellabel on the documentedit
openingbalance, openingrateopening balance document for a bank account with a rate (addTransaction); MNB rate of the closing daycore right; scope on the client
form helpersinvoiceautocomplete, cashregisters, companyaccounts, clientaccounts, journalpreview, companygroup, getDueDate, getTaxDatacore access or super admin; company scope where present

Data model

Table names carry the installation's own prefix in the database: transaction, transaction_item, transaction_settlement, invoice (outstanding), transaction_import_row (through bank/bankimport), label_link, cashregister.

Known limitations

save checks only core modify, neither add nor edit. The add and edit keys are not in the seeds, so for non-super-admin users canAction(add) is false and the new document button is not shown.