Allow PDF variables to provide a bulk evaluation method (second try at #3517) (#3535)

This commit is contained in:
Raphael Michel
2023-08-21 17:59:55 +02:00
committed by GitHub
parent d5951415a4
commit 37df7a6313
4 changed files with 103 additions and 7 deletions

View File

@@ -108,7 +108,10 @@ DEFAULT_VARIABLES = OrderedDict((
("positionid", {
"label": _("Order position number"),
"editor_sample": "1",
"evaluate": lambda orderposition, order, event: str(orderposition.positionid)
"evaluate": lambda orderposition, order, event: str(orderposition.positionid),
# There is no performance gain in using evaluate_bulk here, but we want to make sure it is used somewhere
# in core to make sure we notice if the implementation of the API breaks.
"evaluate_bulk": lambda orderpositions: [str(p.positionid) for p in orderpositions],
}),
("order_positionid", {
"label": _("Order code and position number"),