Workflow

How to Cancel an Invoice / Receipt

Verified end to end. Demo run cancel-invoice-receipt-fr-20260519T234010Z created and paid FR 9999/849, cancelled it from the FR view, and verified the FR list returned ANU / Canceled.

Evidence Summary

Invoice / receipt route
/vendas/fr/view/OTk5OTAwODQ5
List route
/vendas/fr
Workflow run
cancel-invoice-receipt-fr-20260519T234010Z
Cancelled document
999900849 / FR 9999/849
Evidence file
raw/playwright/workflows/latest-cancel-invoice-receipt-fr.json

Verified invoice receipt cancellation workflow

When to Use This

Use Cancel on an FR when the issued invoice / receipt must be annulled. In the verified run, the FR was already paid during creation, OfficeGest still required a cancellation reason, changed the document state to ANU, kept the paid value visible in the list, and reversed the stock movement from the sold line.

Cancellation is an irreversible operation in the OfficeGest confirmation dialog. Use it only when the business and fiscal rules allow annulling the issued FR.

Step-by-Step

  1. Open Sales / Invoice / Receipt [FR] and open the FR view. The verified run used FR 9999/849.
  2. Confirm it is the correct paid document. The verified FR row had total 1.97, paid value 1.97, and pending value 0.00.
  3. Click the red Cancel action in the FR action bar.
  4. In Reason for Cancellation, select a cancellation reason. The verified run used reason id 1, visible as Erro de faturacao.
  5. Click the red Cancel button inside the reason modal.
  6. Confirm the warning dialog: Are you sure you want to cancel? This irreversible operation.
  7. Search the FR list for the document number. The verified row returned estado=ANU, visible state Canceled, total 1.97, paid value 1.97, and pending value 0.00.

Verified Cancellation Values

FieldValue
Internal number999900849
Visible document numberFR 9999/849
Customer[910] 100 Ouvidos Lda, VAT 509031862
Payment before cancellation[NUM] Numerario amount 1.97; validation returned valid:true and troco:0.
Cancellation reasonid_motivo_anulacao=1, Erro de faturacao
Final stateANU, visible as Canceled
Total1.97
Paid / pendingValorPago=1.97; pending value remained 0.00 in the FR list row.
Stock effectWarehouse 1 stock for article AI-DEMO-20260519-021105 moved from -37 before FR creation to -38 after save, then returned to -37 after cancellation.

Backend Calls Observed

Action or endpointPurpose
payment&option=addAdds the immediate FR cash payment row before the document is saved.
payment&option=validateValidates that the payment equals the FR total before final save.
saveDocumentFinishes the paid FR and opens the final FR view.
Sel2_Select_v2 with table=motivos_docsLoads active cancellation reasons where is_anulacao=1.
deleteDocumentSubmits the actual FR cancellation with num=999900849, tipoop=FR, and the selected cancellation reason.
DT_List_DocumentosVerifies the FR row in the list after cancellation. The returned row had estado=ANU and desig_estado=Canceled.
dt_list_recalc_stock_articles_lojasVerifies warehouse stock before creation, after save, and after cancellation.

Raw evidence: raw/playwright/workflows/cancel-invoice-receipt-fr-20260519T234010Z.json. Screenshots: assets/screenshots/cancel-invoice-receipt-fr-20260519T234010Z-01-fr-line-before-payment.png through assets/screenshots/cancel-invoice-receipt-fr-20260519T234010Z-05-fr-list.png.

Validation Notes