Workflow

How to Convert a Sales Order to an Invoice Draft

Verified to draft. Demo run sales-order-to-invoice-draft-20260519T161456Z created sales order ENC 9999/104 / 999900104, used the saved order's Invoice / Invoice action, and opened invoice draft 459 at /vendas/ft/rasc/NDU5. The FT draft was not finalized.

Evidence Summary

Source view
/vendas/enc/view/OTk5OTAwMTA0
Target draft
/vendas/ft/rasc/NDU5
Workflow run
sales-order-to-invoice-draft-20260519T161456Z
Source order
999900104 / ENC 9999/104
Created draft
459, invoice type FT
Evidence file
raw/playwright/workflows/latest-sales-order-to-invoice-draft.json

Verified sales order to invoice draft conversion workflow

When to Use This

Use this workflow when a customer order has been accepted and the next step is to prepare a normal customer invoice. The conversion creates an Invoice [FT] draft from the sales order lines. It does not finalize the invoice, post the final invoice state, or collect payment.

In the verified run, the source sales order remained ABR / Open after draft creation. Treat the generated FT as a draft that still needs review and final save.

Step-by-Step

  1. Open the sales order that should be invoiced. The verified source was ENC 9999/104.
  2. Confirm the order is the correct customer and backlog line. The verified order was for customer 910, 100 Ouvidos Lda, with article AI-DEMO-20260519-021105, quantity 1, and total 1.97.
  3. In the bottom action bar, open Invoice.
  4. Choose Invoice. This maps to facturar('ft').
  5. Confirm the Are you sure? dialog.
  6. OfficeGest calls facturardoc with source tipoop=ENC, source number 999900104, and target tipoopdest=ft.
  7. OfficeGest returns the draft identifier. The verified response was "OK:459:vendas".
  8. OfficeGest opens the FT draft route /vendas/ft/rasc/NDU5.
  9. Review the copied invoice draft before saving. The verified draft kept reference AI-ENC-FT-20260519T161456Z, type FT, and copied the source line from ENC 9999/104.
  10. When the invoice is ready, continue with the normal Create a Sales Invoice save/finalization checks.

Conversion Options Observed

Menu itemObserved handlerMeaning
Invoicefacturar('ft')Creates an FT draft from the order. This is the verified path.
Invoice / Receiptfacturar('fr')Creates an FR draft path from the order. The final payment step was not run in this workflow.
Internal Docfacturar('enc')Creates an ENC/internal document path from the order.

Verified Values

FieldValue
Source sales order999900104 / ENC 9999/104
Source state after conversionABR / Open, total 1.97, paid 0.
Created FT draft459, opened at /vendas/ft/rasc/NDU5.
Draft referenceAI-ENC-FT-20260519T161456Z
Draft line sourcendocori=999900104, tipodocori=ENC, linhandocori=1.
Draft lineArticle AI-DEMO-20260519-021105, quantity 1, unit price about 1.599, VAT 23%.

Backend Calls Observed

Action or endpointPurpose
saveDocumentCreated the source ENC sales order. The verified source save returned 999900104%&=&OKDOC&=&.
facturardocConverted the source ENC into an FT draft. Payload included tipoopdest=ft, tipoop=ENC, and num=999900104. Response: "OK:459:vendas".
listaTabDocumentoLoaded the generated FT draft lines after opening /vendas/ft/rasc/NDU5.
dt_list_draftsQueried sales drafts for TipoOp=FT after conversion.
DT_List_DocumentosChecked the source ENC list after conversion and confirmed the order row still appeared as open.

Raw evidence: raw/playwright/workflows/sales-order-to-invoice-draft-20260519T161456Z.json. Screenshots: assets/screenshots/sales-order-to-invoice-draft-20260519T161456Z-01-enc-filled.png through assets/screenshots/sales-order-to-invoice-draft-20260519T161456Z-04-ft-list.png.

Validation Notes