Workflow

How to Cancel a Sales Invoice

Verified end to end. Demo run cancel-sales-invoice-ft-20260519T172726Z created invoice FT 9999/1672, cancelled it from the invoice view, and verified the FT list returned ANU / Canceled.

Evidence Summary

Invoice route
/vendas/ft/view/OTk5OTAxNjcy
List route
/vendas/ft
Workflow run
cancel-sales-invoice-ft-20260519T172726Z
Cancelled invoice
999901672 / FT 9999/1672
Evidence file
raw/playwright/workflows/latest-cancel-sales-invoice-ft.json

Verified sales invoice cancellation workflow

When to Use This

Use Cancel on an FT invoice when the issued invoice must be annulled instead of corrected with a credit note. In the verified run, the action was irreversible, required a cancellation reason, changed the FT state to ANU, and reversed the stock effect from the invoice line.

Only cancel when the business and fiscal rules allow cancellation. If the invoice should remain issued but be financially corrected, use the credit note workflow instead.

Step-by-Step

  1. Open Sales / Invoice [FT] and open the invoice view. The verified run used FT 9999/1672.
  2. Confirm the invoice is the correct document and still shows Open. The verified FT row had total 1.97, paid value 0.00, and pending value 1.97.
  3. Click the red Cancel action in the invoice action bar.
  4. OfficeGest checks whether the document can be cancelled through podeAnularDoc. In the verified run, the response was {"succeeded":true,"message":null,"params":null}.
  5. In Reason for Cancellation, choose a cancellation reason. The verified run used reason id 1, visible as Erro de faturacao.
  6. Click the red Cancel button inside the reason modal.
  7. Confirm the warning dialog: Are you sure you want to cancel? This irreversible operation.
  8. Search the FT list for the invoice number. The verified row returned estado=ANU, visible state Canceled, total 1.97, paid value 0.00, and pending value 1.97.

Verified Cancellation Values

FieldValue
Internal number999901672
Visible document numberFT 9999/1672
ReferenceAI-FT-CANCEL-20260519T172726Z
Customer[910] 100 Ouvidos Lda, VAT 509031862
Cancellation reasonid_motivo_anulacao=1, Erro de faturacao
Final stateANU, visible as Canceled
Total1.97
Paid / pendingValorPago=0; pending value remained 1.97 in the FT list row.
Stock effectWarehouse 1 stock for article AI-DEMO-20260519-021105 moved from -2 before cancellation to -1 after cancellation.

Backend Calls Observed

Action or endpointPurpose
podeAnularDoc&num=999901672&tipoop=FTChecks whether the FT can be cancelled before showing or submitting the cancellation flow.
Sel2_Select_v2 with table=motivos_docsLoads active cancellation reasons where is_anulacao=1.
deleteDocumentSubmits the actual FT cancellation with num=999901672, tipoop=FT, and the serialized document form including cancellation reason.
DT_List_DocumentosVerifies the invoice row in the FT list after cancellation. The returned row had estado=ANU and desig_estado=Canceled.
dt_list_recalc_stock_articles_lojasVerifies warehouse stock before and after cancellation.

Raw evidence: raw/playwright/workflows/cancel-sales-invoice-ft-20260519T172726Z.json. Screenshots: assets/screenshots/cancel-sales-invoice-ft-20260519T172726Z-01-filled-invoice.png through assets/screenshots/cancel-sales-invoice-ft-20260519T172726Z-05-ft-list.png.

Validation Notes