Workflow

How to Convert a Sales Order to an Invoice / Receipt Draft

Verified to draft. Demo run sales-order-to-invoice-receipt-draft-20260519T162611Z created sales order ENC 9999/105 / 999900105, used the saved order's Invoice / Invoice / Receipt action, and opened invoice / receipt draft 461 at /vendas/fr/rasc/NDYx. The FR draft was not finalized or paid.

Evidence Summary

Source view
/vendas/enc/view/OTk5OTAwMTA1
Target draft
/vendas/fr/rasc/NDYx
Workflow run
sales-order-to-invoice-receipt-draft-20260519T162611Z
Source order
999900105 / ENC 9999/105
Created draft
461, invoice / receipt type FR
Evidence file
raw/playwright/workflows/latest-sales-order-to-invoice-receipt-draft.json

Verified sales order to invoice receipt draft conversion workflow

When to Use This

Use this workflow when a customer order has been accepted and should become an Invoice / Receipt [FR], where finalization normally includes payment. The conversion creates an FR draft from the order lines. It does not complete payment or finalize the FR document.

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

Step-by-Step

  1. Open the sales order that should become an invoice / receipt. The verified source was ENC 9999/105.
  2. Confirm the order is the correct customer and line set. 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 / Receipt. This maps to facturar('fr').
  5. Confirm the Are you sure? dialog.
  6. OfficeGest calls facturardoc with source tipoop=ENC, source number 999900105, and target tipoopdest=fr.
  7. OfficeGest returns the draft identifier. The verified response was "OK:461:vendas".
  8. OfficeGest opens the FR draft route /vendas/fr/rasc/NDYx.
  9. Review the copied invoice / receipt draft before saving. The verified draft kept reference AI-ENC-FR-20260519T162611Z, type FR, and copied the source line from ENC 9999/105.
  10. When the invoice / receipt is ready, continue with the normal Create an Invoice / Receipt checks, including payment before finalization.

Conversion Options Observed

Menu itemObserved handlerMeaning
Invoicefacturar('ft')Creates an FT draft from the order. Use this when payment will be handled later.
Invoice / Receiptfacturar('fr')Creates an FR draft from the order. This is the verified path in this guide.
Internal Docfacturar('enc')Creates an ENC/internal document path from the order.

Verified Values

FieldValue
Source sales order999900105 / ENC 9999/105
Source state after conversionABR / Open, total 1.97, paid 0.
Created FR draft461, opened at /vendas/fr/rasc/NDYx.
Draft referenceAI-ENC-FR-20260519T162611Z
Draft line sourcendocori=999900105, 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 999900105%&=&OKDOC&=&.
facturardocConverted the source ENC into an FR draft. Payload included tipoopdest=fr, tipoop=ENC, and num=999900105. Response: "OK:461:vendas".
listaTabDocumentoLoaded the generated FR draft lines after opening /vendas/fr/rasc/NDYx.
dt_list_draftsQueried sales drafts for TipoOp=FR 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-receipt-draft-20260519T162611Z.json. Screenshots: assets/screenshots/sales-order-to-invoice-receipt-draft-20260519T162611Z-01-enc-filled.png through assets/screenshots/sales-order-to-invoice-receipt-draft-20260519T162611Z-04-fr-list.png.

Validation Notes