Skip to content

feat(print): feeder resolves line-item to-one relations — {{Unit}} renders in items columns (#6501) - #6502

Merged
delchev merged 1 commit into
masterfrom
feat/print-feeder-item-relations
Aug 4, 2026
Merged

feat(print): feeder resolves line-item to-one relations — {{Unit}} renders in items columns (#6501)#6502
delchev merged 1 commit into
masterfrom
feat/print-feeder-item-relations

Conversation

@delchev

@delchev delchev commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Closes #6501.

What

The generated <Entity>PrintFeeder fed each line-item row only its scalar fields, so a print template's items table could not render the line's unit or product — while header relations resolved to full maps + __label. Line-item to-one relations now resolve the same way:

  • PrintFeederSupport contributes itemNodes — one per to-one relation of the line-items entity, the composition back-reference to the document excluded (that is the header itself). Same shapes as the header nodes: a same-model target names its fields one by one (the generated Java stays the audit of what a print receives); a cross-model target is copied reflectively per the Intent: removing a field silently invalidates cross-model consumers' generated code #6422 rule, so this project's committed gen/ survives the owner retiring a field. Item variables are item-prefixed so a header relation of the same name (Customer on both) cannot collide.
  • The template loads the target per row through its generated repository (validations + the multilingual translation overlay apply — a bg request prints "1 месец"), caches lookups per distinct key rather than per row, and hangs the map (with __label) under the relation's own key — so {{Unit}} renders the label and {{Unit.Name}} descends, exactly like the header relations.
  • generateUtils.js passes the new collection through with the same gen-folder/package derivation as the header nodes.

Tests

  • PrintFeederSupportTest.itemToOneRelationsAreFedWithLabelAndFields — back-ref exclusion, Settings-perspective routing, prefixed variables, same-model named fields vs cross-model none (5/5 green).
  • IntentEmissionCoverageITBillLine gains a Unit relation (the multilingual setting — the literal "1 month" case); the generated BillPrintFeeder is asserted to contain the distinct-key cache, the repository load, the __label put and the row-key hang — and the fixture app compiles and publishes end-to-end (1/1 green locally), so the emitted Java went through real javac.

🤖 Generated with Claude Code

…} / {{Unit.Name}} render in items columns (#6501)

The generated PrintFeeder's items map carried only the line's scalar
fields, so an invoice line could not print its unit or product - while
header relations DID get resolved maps + __label. Each line-item to-one
relation is now fed the same way: PrintFeederSupport contributes
itemNodes (the composition back-reference to the document excluded -
that is the header itself), and the template loads the target per row
through its generated repository (validations + the multilingual
translation overlay apply), caches lookups per DISTINCT key rather than
per row, and hangs a map carrying __label + the target's fields under
the relation's own key - so {{Unit}} renders the label and {{Unit.Name}}
descends. Same-model targets name their fields one by one (the audit);
a cross-model target is copied reflectively per the #6422 rule, so this
project's committed gen/ survives the owner retiring a field.

Covered by PrintFeederSupportTest (item nodes: back-ref exclusion,
Settings perspective, prefixed variables, cross-model no-named-fields)
and IntentEmissionCoverageIT (BillLine gains a Unit relation; the
generated BillPrintFeeder's lookup/cache/__label emission is asserted
and the whole app compiles and publishes end-to-end - green locally).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@delchev
delchev force-pushed the feat/print-feeder-item-relations branch from e7e3eec to 3c05c84 Compare August 4, 2026 15:06
@delchev
delchev merged commit e39cdb0 into master Aug 4, 2026
9 checks passed
@delchev
delchev deleted the feat/print-feeder-item-relations branch August 4, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Print feeder: line-item to-one relations are not fed - an items column cannot render its unit/product

1 participant