Skip to content

[[2D_CONTENT]] resolves to part URL instead of lot URL when generating stock labels in Twig mode #1268

@MayNiklas

Description

@MayNiklas

Description
When generating labels for stock/lots using the label feature in Twig mode, [[2D_CONTENT]] points to the part route (/scan/part/...) instead of the lot route (/scan/lot/...).

This happens with templates like:

{{ barcode_svg(placeholder('[[2D_CONTENT]]', element), 'QRCODE')|data_uri }}

Stock labels generated in Twig mode produce QR codes that open the wrong entity.

To Reproduce

Steps to reproduce the behavior:

  1. Open label generation.
  2. Select target type Part Lot / Stock.
  3. Use Twig mode and set line content to:
{{ barcode_svg(placeholder('[[2D_CONTENT]]', element), 'QRCODE')|data_uri }}
  1. Generate a label for a stock/lot entry.
  2. Scan the QR code.

QR redirects to the part (/scan/part/{id}).

Expected behavior

QR should redirect to the selected lot (/scan/lot/{id}).

Server Side

  • Part-DB Version: 2.7.1

Additional context

For lot targets, placeholder resolution appears to fall back to the parent part too early for unknown placeholders.
As a result, [[2D_CONTENT]] gets resolved in part context before barcode-specific placeholder handling can use the lot context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions