Workflow

How to Finalize a Purchase / Expense

Verified end to end. Demo run purchase-expense-finalize-20260519T035328Z finalized CD draft 456 into document CD 9999/53 / 999900053, paid it with [NUM] Numerario, and increased warehouse 1 stock for the article from 1 to 2.

Evidence Summary

Draft source
/compras/cd/rasc/NDU2
Final view
/compras/cd/view/OTk5OTAwMDUz
Created document
999900053 / CD 9999/53
Status
LIQ / Finished
Supplier
[100] AI Demo Supplier 20260519T030323Z
Evidence files
raw/playwright/workflows/latest-purchase-expense-finalize.json and raw/playwright/workflows/latest-purchase-expense-finalize-recovery.json

Verified purchase expense finalization workflow

When to Use This

Use this workflow when a Purchases / Expenses CD draft is ready to become a finished supplier purchase/expense document. The verified path starts from an existing draft, clicks End, adds payment, confirms the save, and verifies the finished view, payment panel, document list, and stock movement.

Step-by-Step

  1. Open Purchases / Purchases / Expenses [CD].
  2. In the Drafts table, open the draft with Edit. The verified draft was 456.
  3. Review supplier, supplier VAT, supplier document number, dates, series, employee, and line totals.
  4. Confirm the document has at least one line. The verified line used article AI-DEMO-20260519-021105, quantity 1, unit cost 1.23, VAT 23%, and total 1.51.
  5. Click End. OfficeGest calls payment&option=validate; before payment it reports that payment must equal or exceed the document total.
  6. In the Payment modal, choose a payment method. The verified run selected [NUM] Numerario.
  7. Confirm the payment line amount equals the document total. The verified payment line was 1.51.
  8. Click Save in the Payment modal.
  9. Confirm the Are you sure? dialog with OK.
  10. OfficeGest posts saveDocument, redirects to the finished CD view, and shows the payment panel. The verified response was 999900053%&=&OKDOC&=&.
  11. Check the CD list if needed. Searching for 999900053 returned CD 9999/53, status LIQ, total 1.51, and supplier reference AI-CD-DRAFT-20260519T034251Z.

Verified Final Document

FieldValue
Internal number999900053
Visible document numberCD 9999/53
Draft converted456
Supplier document numberAI-CD-DRAFT-20260519T034251Z
Supplier[100] AI Demo Supplier 20260519T030323Z, VAT 590303236
Payment[NUM] Numerario, bank/cash account [CXC] Caixa Defeito - Caixa Colaborador Demo, value 1.51
StatusLIQ, visible as Finished
Stock resultArticle AI-DEMO-20260519-021105, warehouse 1, stock increased from 1 to 2.

Backend Calls Observed

Action or endpointPurpose
payment&option=validateChecks whether payment covers the CD total. Before selecting a method it returned valid: NONE; after adding payment it returned valid: true.
payment&option=addAdds the selected payment line. The verified payload used modopagamento=NUM, entidade=100, compras=T, tipoop=CD, and total 1.51.
saveDocumentFinalizes the draft into a CD document. The verified payload included num=456, id=45392, estado=ABR, isedit=T, and israsc=1.
payment&option=get_paymentReloads payment details on the finished document view.
listaTabDocumentoLoads finished document lines in view mode. The finished line table used mode=view, document table 45477, and encoded document number OTk5OTAwMDUz.
DT_List_DocumentosFVerifies the finalized supplier document in the CD list. Search for 999900053 returned one row.
dt_list_draftsVerifies that the converted draft is no longer in the draft list.
dt_list_recalc_stock_articles_lojasVerifies article stock by warehouse. Warehouse 1 returned QtdStock: 2 after finalization.

Raw evidence: raw/playwright/workflows/purchase-expense-finalize-20260519T035328Z.json plus recovery verification raw/playwright/workflows/purchase-expense-finalize-20260519T035328Z-recovery.json. Screenshots: assets/screenshots/purchase-expense-finalize-20260519T035328Z-01-open-draft.png and assets/screenshots/purchase-expense-finalize-20260519T035328Z-02-final-view-recovered.png.

Validation Notes