Skip to content

Commit 52533b3

Browse files
authored
Merge pull request #4 from IntentFile/spec/print-language-and-partition-sources
spec: print render language — language / languageFrom on snapshot children and notify attachments
2 parents 002f3b9 + e42ce3c commit 52533b3

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

docs/spec/entities.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,18 @@ Two `function` roles attach **files** to a record. Both are composition children
196196

197197
A snapshot requires a **document** master (only a document has a print template to render from). Minting a copy is wired into the workflow: bind the generated snapshot handler (named `<Master>SnapshotGenerator`) as the `delegate:` of a [service task](/spec/processes#service-tasks) at the step that finalises the document — typically right after *issue*. Re-issuing after an amendment keeps the document's number and mints the next version, which pairs naturally with [`immutableWhen`](#immutablewhen-immutable-user-write-immutability) and an issue-stamped [document number](#document-numbering).
198198

199+
The **language** a copy is minted in is a knob on the snapshot child — `language: <code>` fixes the print-template language, or `languageFrom: <relation>.<field>` reads it per record from a one-hop path on the document master (a to-one relation and a string field of its target holding the code — the customer decides the language their invoice is issued in; the path may cross model boundaries like any other reference):
200+
201+
```yaml
202+
- name: SalesInvoiceCopy
203+
function: Snapshot
204+
languageFrom: customer.language
205+
relations:
206+
- { name: SalesInvoice, kind: manyToOne, to: SalesInvoice, composition: true, required: true }
207+
```
208+
209+
The two knobs are mutually exclusive. Absent both — or when the resolved value is blank — the mint falls back to the first entry of the application's configured language set, resolved at mint time. An unresolvable `languageFrom` path is a generation error, never a silent wrong-language copy. Interactive printing is a separate concern: the print action always renders **live** current data in the language the user picks, while the snapshot panel serves the frozen issued copies — the two coexist on the document's page.
210+
199211
## Setting entities
200212

201213
```yaml

docs/spec/glue.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,16 @@ notifications:
5151

5252
Add **`attach: print`** and the message carries the record's **own document** — the record rendered through its [print template](/spec/presentation#printable-documents) and attached. This is the declarative form of the most common outbound action a business document has: the invoice to its customer, the payslip to its employee, a reminder that carries the invoice it is about.
5353

54+
The **render language**: `language:` fixes the print-template language; `languageFrom: <relation>.<field>` reads it per record from a one-hop to-one path of the entity the message is about (mutually exclusive with `language:`). Absent both — or when the resolved value is blank — the render falls back to the first entry of the application's configured language set at send time.
55+
5456
```yaml
5557
notify:
5658
to: Customer.email # literal / direct field / one-hop relation.field
5759
subject: "Invoice {number}" # {field} and {relation.field} interpolation
5860
body: "Dear {Customer.name}, please find invoice {number} attached."
5961
attach: print # render THIS record's print template and attach it
60-
language: bg # optional print-template language
62+
language: bg # optional FIXED print-template language
63+
# or per record: languageFrom: Customer.locale (a one-hop relation.field holding the code)
6164
```
6265

6366
`attach`'s only value is `print`, and the entity must be a **document** (a header with a line-items child) — that is the shape a print template exists for. Attaching the print of a plain entity is rejected up front rather than silently sending a message without the document it promised. The attachment comes from the record's own data through the same path the interactive print takes, so a document mailed and a document printed are the same document.

0 commit comments

Comments
 (0)