From 2b176332bab867360015352e65279e42849146e6 Mon Sep 17 00:00:00 2001 From: delchev Date: Thu, 6 Aug 2026 14:30:58 +0300 Subject: [PATCH] spec: generates items list form - computed create-from lines (expression cells) `generates.items` gains a second, mutually-exclusive shape: a LIST of computed synthetic lines whose cells are expressions over the source record (numeric arithmetic, {field} string interpolation, a source foreign-key copy, or a now/literal), for a create-from that must build a computed line rather than clone a source child 1:1. Tracks eclipse-dirigible/dirigible#6555. Co-Authored-By: Claude Opus 4.8 --- versions/1.0.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/versions/1.0.md b/versions/1.0.md index d10146a..54ce817 100644 --- a/versions/1.0.md +++ b/versions/1.0.md @@ -961,6 +961,18 @@ generates: Adds a button on the source view; the clone saves through the target's own layer, so numbering, status init and calculated fields fire. An optional `sourceStatus` flips the source record's status once the target exists. +`items` has two mutually-exclusive shapes. As an **object** (above) it **mirrors** each source child row 1:1. As a **list** it builds **computed** synthetic lines whose cells are expressions over the **source** record — use it when a create-from must produce a computed line (e.g. one invoice line carrying a period's rolled-up total) rather than a 1:1 clone. The target's line-items child is resolved automatically (it is never named): + +```yaml + items: # computed synthetic lines over the SOURCE record + - name: "Services for {period}" # string: {field} interpolation (or a source-field copy / literal) + quantity: 1 # numeric: an arithmetic expression over the source, rounded to + price: BillableAmount # the target field's scale (a bare literal is a trivial one) + when: "BillableAmount != 0" # optional guard: ==|!= +``` + +A **numeric** cell is an arithmetic expression evaluated the same way as a calculated field or a posting item amount (source identifiers are the field names; a null reads as 0); a **string** cell interpolates `{field}` placeholders, copies a bare source property, or is a plain literal; a **to-one relation** cell copies the source foreign key; a `when` cell guards the whole line. The list form is not available on a scheduled generate. + ### transitions — guarded status flips A per-record button that flips an entity's `function: EntityStatus` relation on demand — void, cancel, close, reopen — guarded by allowed source statuses and an optional condition. A flip from any other status (or a failing guard) is rejected; a successful flip publishes a `-transitioned` event that `postings` and integrations can observe.