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 typeFR- Evidence file
raw/playwright/workflows/latest-sales-order-to-invoice-receipt-draft.json
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
- Open the sales order that should become an invoice / receipt. The verified source was
ENC 9999/105. - Confirm the order is the correct customer and line set. The verified order was for customer
910, 100 Ouvidos Lda, with articleAI-DEMO-20260519-021105, quantity1, and total1.97. - In the bottom action bar, open Invoice.
- Choose Invoice / Receipt. This maps to
facturar('fr'). - Confirm the Are you sure? dialog.
- OfficeGest calls
facturardocwith sourcetipoop=ENC, source number999900105, and targettipoopdest=fr. - OfficeGest returns the draft identifier. The verified response was
"OK:461:vendas". - OfficeGest opens the FR draft route
/vendas/fr/rasc/NDYx. - Review the copied invoice / receipt draft before saving. The verified draft kept reference
AI-ENC-FR-20260519T162611Z, typeFR, and copied the source line fromENC 9999/105. - When the invoice / receipt is ready, continue with the normal Create an Invoice / Receipt checks, including payment before finalization.
Conversion Options Observed
| Menu item | Observed handler | Meaning |
|---|---|---|
| Invoice | facturar('ft') | Creates an FT draft from the order. Use this when payment will be handled later. |
| Invoice / Receipt | facturar('fr') | Creates an FR draft from the order. This is the verified path in this guide. |
| Internal Doc | facturar('enc') | Creates an ENC/internal document path from the order. |
Verified Values
| Field | Value |
|---|---|
| Source sales order | 999900105 / ENC 9999/105 |
| Source state after conversion | ABR / Open, total 1.97, paid 0. |
| Created FR draft | 461, opened at /vendas/fr/rasc/NDYx. |
| Draft reference | AI-ENC-FR-20260519T162611Z |
| Draft line source | ndocori=999900105, tipodocori=ENC, linhandocori=1. |
| Draft line | Article AI-DEMO-20260519-021105, quantity 1, unit price about 1.599, VAT 23%. |
Backend Calls Observed
| Action or endpoint | Purpose |
|---|---|
saveDocument | Created the source ENC sales order. The verified source save returned 999900105%&=&OKDOC&=&. |
facturardoc | Converted the source ENC into an FR draft. Payload included tipoopdest=fr, tipoop=ENC, and num=999900105. Response: "OK:461:vendas". |
listaTabDocumento | Loaded the generated FR draft lines after opening /vendas/fr/rasc/NDYx. |
dt_list_drafts | Queried sales drafts for TipoOp=FR after conversion. |
DT_List_Documentos | Checked 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
- This workflow stops at draft: no final FR was saved and no payment was recorded in the verified run.
- The copied line keeps source metadata: the FR draft line records the original ENC number and line.
- Payment still matters: FR finalization normally requires payment validation, so review the payment modal before ending the document.
- Source state: the ENC row was still open immediately after draft creation; do not treat it as invoiced until the target FR is finalized and list state is verified.