Evidence Summary
- Route
/compras/cd/create- List route
/compras/cd- Page title
OG - Purchases / Expenses [CD]- Workflow run
purchase-expense-draft-20260519T034251Z- Created draft
456- Temporary document table
45236before save,45267when reopened as draft- Evidence file
raw/playwright/workflows/latest-purchase-expense-draft.json
When to Use This
Use Purchases / Expenses [CD] to register supplier purchase or expense documents when the user is not ready to finish the purchase immediately. The verified draft path confirms supplier selection, supplier document number validation, article line insertion, totals calculation, and draft-list verification. When the draft is ready to become a finished supplier document, continue with Finalize a Purchase / Expense.
Step-by-Step
- Open Purchases / Purchases / Expenses [CD], then choose the create action, or navigate directly to
/compras/cd/create. - Confirm the page title is OG - Purchases / Expenses [CD].
- Select the Supplier. The verified run used supplier
100, AI Demo Supplier 20260519T030323Z, VAT590303236. OfficeGest resolved supplier data throughNameEntidades&tabla=Forn. - Enter the required Supplier's N. value. The verified run used
AI-CD-DRAFT-20260519T034251Z. OfficeGest checked duplicates withfindNumNoFornagainstdocumcd. - Review document dates. The verified create page used emission date
19/05/2026and account entry date19/05/2026. - Review defaults: series
9999, employee1/ Demo, payment conditionPP, currencyEUR, warehouse1, movement stock flag1, and expense type1. - Search for an article in the document lines area and add the quantity. The verified line used article
AI-DEMO-20260519-021105, quantity1, warehouse1. - Confirm the line appears in the table. The verified line had unit cost
1.23, VAT23%, no discount, total without VAT1.23, VAT value0.2829, and total with VAT1.5129. - Review totals. OfficeGest displayed
1,51 EURpayable and calculated total1.51. - Click Save Draft. The verified save called
saveRascunhoand returnedOK:456. - Return to
/compras/cdand confirm the draft appears in the draft list. The verified row showed draft456, supplierAI Demo Supplier 20260519T030323Z, VAT590303236, employeeDemo, series9999, typeCD, and total1.51.
Fields and Tabs
| Area | What the user should check |
|---|---|
| Supplier header | Supplier, VAT number, supplier document number, emission date, account entry date, series, employee, and warehouse. |
| Details | Expense type, commission type, observations, classification, payment condition, due date, currency, exchange rate, and billing address fields loaded from the supplier. |
| Document lines | Article search, supplier article code search, quantity, line table, duplicate line checks, VAT, totals, and stock movement flag. |
| Footer actions | Save Draft persists the draft through saveRascunho. End is the separate finalization path covered in Finalize a Purchase / Expense. |
Verified Draft Values
| Field | Value |
|---|---|
| Draft number | 456 |
| Document type | CD |
| Series | 9999 |
| Supplier | 100 / AI Demo Supplier 20260519T030323Z |
| Supplier VAT | 590303236 |
| Supplier document number | AI-CD-DRAFT-20260519T034251Z |
| Employee | 1 / Demo |
| Article line | AI-DEMO-20260519-021105, quantity 1, warehouse 1 |
| Totals | 1.23 net, 0.2829 VAT, 1.51 rounded payable total |
Backend Calls Observed
| Action or endpoint | Purpose |
|---|---|
dt_list_drafts | Loads draft CD documents. Before save the list had recordsTotal: 213; after save it returned recordsTotal: 214 and row 456. |
Sel2_Select&table=forn | Resolves supplier selector values by supplier id and returns VAT metadata. |
NameEntidades&tabla=Forn | Loads supplier master data, including address, VAT, email, phone, active flag, and accounting account 2211100100. |
Sel2_Select&table=moradasf | Loads supplier address options for the selected supplier. |
findNumNoForn | Checks duplicate supplier document number for table documcd. |
loadArtigoReducido&compras=T | Loads reduced purchase article metadata, including unit, VAT, cost, stock, active flag, lot/serial flags, and accounting classification. |
insertLinhaTabDoc | Adds the article line into the temporary CD document table with isforn=T, supplier 100, currency EUR, payment condition PP, and document type CD. |
listaTabDocumento | Reloads line-table data before save and after reopening draft 456. |
price_variation_article | Compares the selected article price for supplier 100; the verified response reported price 1.23 and no variation. |
create_document&option=calcular_totais | Calculates net, VAT, rounded total, payable total, VAT table, and line totals. |
saveRascunho | Saves the draft. The verified response was OK:456. |
DT_List_DocumentosF | Loads finalized CD purchase/expense documents on the list page. This was observed on navigation, but the verified workflow only created a draft. |
Raw evidence: raw/playwright/workflows/purchase-expense-draft-20260519T034251Z.json. Screenshots: assets/screenshots/purchase-expense-draft-20260519T034251Z-01-create-page.png through assets/screenshots/purchase-expense-draft-20260519T034251Z-04-verified-draft-list.png.
Validation Notes
- Supplier document number is required: the create script fills
NumNoFornbefore saving because the page validates it and checks duplicates throughfindNumNoForn. - Draft save does not finalize accounting:
saveRascunhopersisted the draft and reopened it in draft mode. Use Finalize a Purchase / Expense for the verified End, payment, finished-document, and stock-posting path. - Article price source: the purchase line used article cost
1.23forPrecoUni, while the loaded article also exposed sale price1.5991869918699. - Drafts do not prove final stock posting: the line had
MovimentaStock=1in the draft form, but the stock increase was only verified after finalization. The final CD run increased warehouse1stock from1to2.