Workflow

How to Create a Purchase / Expense Draft

Verified draft save. Demo run purchase-expense-draft-20260519T034251Z created CD draft 456 for supplier [100] AI Demo Supplier 20260519T030323Z and verified it through dt_list_drafts.

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
45236 before save, 45267 when reopened as draft
Evidence file
raw/playwright/workflows/latest-purchase-expense-draft.json

Verified purchase expense draft workflow

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

  1. Open Purchases / Purchases / Expenses [CD], then choose the create action, or navigate directly to /compras/cd/create.
  2. Confirm the page title is OG - Purchases / Expenses [CD].
  3. Select the Supplier. The verified run used supplier 100, AI Demo Supplier 20260519T030323Z, VAT 590303236. OfficeGest resolved supplier data through NameEntidades&tabla=Forn.
  4. Enter the required Supplier's N. value. The verified run used AI-CD-DRAFT-20260519T034251Z. OfficeGest checked duplicates with findNumNoForn against documcd.
  5. Review document dates. The verified create page used emission date 19/05/2026 and account entry date 19/05/2026.
  6. Review defaults: series 9999, employee 1 / Demo, payment condition PP, currency EUR, warehouse 1, movement stock flag 1, and expense type 1.
  7. Search for an article in the document lines area and add the quantity. The verified line used article AI-DEMO-20260519-021105, quantity 1, warehouse 1.
  8. Confirm the line appears in the table. The verified line had unit cost 1.23, VAT 23%, no discount, total without VAT 1.23, VAT value 0.2829, and total with VAT 1.5129.
  9. Review totals. OfficeGest displayed 1,51 EUR payable and calculated total 1.51.
  10. Click Save Draft. The verified save called saveRascunho and returned OK:456.
  11. Return to /compras/cd and confirm the draft appears in the draft list. The verified row showed draft 456, supplier AI Demo Supplier 20260519T030323Z, VAT 590303236, employee Demo, series 9999, type CD, and total 1.51.

Fields and Tabs

AreaWhat the user should check
Supplier headerSupplier, VAT number, supplier document number, emission date, account entry date, series, employee, and warehouse.
DetailsExpense type, commission type, observations, classification, payment condition, due date, currency, exchange rate, and billing address fields loaded from the supplier.
Document linesArticle search, supplier article code search, quantity, line table, duplicate line checks, VAT, totals, and stock movement flag.
Footer actionsSave Draft persists the draft through saveRascunho. End is the separate finalization path covered in Finalize a Purchase / Expense.

Verified Draft Values

FieldValue
Draft number456
Document typeCD
Series9999
Supplier100 / AI Demo Supplier 20260519T030323Z
Supplier VAT590303236
Supplier document numberAI-CD-DRAFT-20260519T034251Z
Employee1 / Demo
Article lineAI-DEMO-20260519-021105, quantity 1, warehouse 1
Totals1.23 net, 0.2829 VAT, 1.51 rounded payable total

Backend Calls Observed

Action or endpointPurpose
dt_list_draftsLoads draft CD documents. Before save the list had recordsTotal: 213; after save it returned recordsTotal: 214 and row 456.
Sel2_Select&table=fornResolves supplier selector values by supplier id and returns VAT metadata.
NameEntidades&tabla=FornLoads supplier master data, including address, VAT, email, phone, active flag, and accounting account 2211100100.
Sel2_Select&table=moradasfLoads supplier address options for the selected supplier.
findNumNoFornChecks duplicate supplier document number for table documcd.
loadArtigoReducido&compras=TLoads reduced purchase article metadata, including unit, VAT, cost, stock, active flag, lot/serial flags, and accounting classification.
insertLinhaTabDocAdds the article line into the temporary CD document table with isforn=T, supplier 100, currency EUR, payment condition PP, and document type CD.
listaTabDocumentoReloads line-table data before save and after reopening draft 456.
price_variation_articleCompares the selected article price for supplier 100; the verified response reported price 1.23 and no variation.
create_document&option=calcular_totaisCalculates net, VAT, rounded total, payable total, VAT table, and line totals.
saveRascunhoSaves the draft. The verified response was OK:456.
DT_List_DocumentosFLoads 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