Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat: tokenise message input

Sidwebworks98b0a14955ed
diff --git a/apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx b/apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx
index 143dfffcbc..b147637d76 100644
--- a/apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx
+++ b/apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx
@@ -1,6 +1,7 @@
-import { useControlField } from "@carbon/form";
+import { useControlField, useField, useFormStateContext } from "@carbon/form";
import {
Button,
+ cn,
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
@@ -8,6 +9,9 @@ import {
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
+ FormControl,
+ FormErrorMessage,
+ FormLabel,
HStack
} from "@carbon/react";
import {
@@ -18,9 +22,9 @@ import {
type TransactionSurface
} from "@carbon/utils";
import { Trans, useLingui } from "@lingui/react/macro";
+import type { MouseEvent, ReactNode, TextareaHTMLAttributes } from "react";
import { useCallback, useMemo, useRef } from "react";
import { LuBraces } from "react-icons/lu";
-import { TextArea } from "~/components/Form";
type MessageWithTokensProps = {
name: string;
@@ -61,6 +65,47 @@ const CONTEXT_LABELS: Record<FieldDef["context"], string> = {
transaction: "Transaction"
};
+// Index `FIELD_REGISTRY` once at module scope. The original code re-filtered
+// the registry for each context on every `groups` recompute (one filter
+// per ctx key on every conditions/surfaces change). One pass at load,
+// bucketed by context — `O(n)` once instead of `O(n)` per ctx per render.
+const FIELDS_BY_CTX: Record<FieldDef["context"], FieldDef[]> = {
+ item: [],
+ storage: [],
+ transaction: []
+};
+for (const f of FIELD_REGISTRY) FIELDS_BY_CTX[f.context].push(f);
+
+// Stable references for default values. `surfacesValue ?? []` would
+// allocate a fresh `[]` every render, busting the `groups` memo — and
+// re-running the per-condition token assembly even when nothing changed.
+const EMPTY_SURFACES: TransactionSurface[] = [];
+const ORDERED_CTX: FieldDef["context"][] = ["storage", "transaction"];
+
+// Hoist the static icon node — re-rendering the parent doesn't need to
+// reallocate the icon element (rendering-hoist-jsx).
+const BRACES_ICON = <LuBraces />;
+
+// Mirror of the runtime `TOKEN_RE` in packages/utils/src/itemRules.ts so the
+// editor highlights exactly what `interpolateMessage` will substitute — no
+// false greens, no missed reds. Inlined rather than re-exported to avoid a
+// UI → runtime import cycle.
+const TOKEN_RE =
+ /\{(condition\[\d+\]\.(?:field|operator|value)|[a-zA-Z_][\w.]*)\}/g;
+
+// Runtime accepts arbitrary suffixes under `item.customFields.*` via the
+// generic dotted-path resolver. Treat any such token as known so the editor
+// stops painting valid custom-field references as errors.
+const CUSTOM_FIELD_PREFIX = "item.customFields.";
+
+// Only background + ring — text stays `text-transparent` (inherited from
+// the overlay) so the textarea's real glyphs show through cleanly. Adding a
+// text color here would render duplicate, mis-aligned text on top of the
+// caret layer.
+const KNOWN_TOKEN_CLS = "rounded-sm bg-blue-500/25 ring-1 ring-blue-500/50";
+const UNKNOWN_TOKEN_CLS =
+ "rounded-sm bg-destructive/20 ring-1 ring-destructive/50";
+
export default function MessageWithTokens({
name,
label,
@@ -69,26 +114,58 @@ export default function MessageWithTokens({
}: MessageWithTokensProps) {
const { t } = useLingui();
const textareaRef = useRef<HTMLTextAreaElement | null>(null);
+ const overlayRef = useRef<HTMLDivElement | null>(null);
const [surfacesValue] =
useControlField<TransactionSurface[]>(surfacesFieldName);
- const surfaces = surfacesValue ?? [];
+ const surfaces = surfacesValue ?? EMPTY_SURFACES;
- // Carbon TextArea wraps a native textarea; reach for it via DOM after mount.
- const setRefFromDom = useCallback((el: HTMLDivElement | null) => {
- textareaRef.current = el?.querySelector("textarea") ?? null;
- }, []);
+ const { getInputProps, error, defaultValue } = useField(name);
+ const [value, setValue] = useControlField<string>(name);
+ const text = (value ?? defaultValue ?? "") as string;
+
+ const formState = useFormStateContext();
+ const isDisabled = formState.isDisabled;
+ const isReadOnly = formState.isReadOnly;
+ const isLocked = isDisabled || isReadOnly;
+
+ const insertToken = useCallback(
+ (token: string) => {
+ const el = textareaRef.current;
+ if (!el) return;
+ const start = el.selectionStart ?? el.value.length;
+ const end = el.selectionEnd ?? el.value.length;
+ const insertion = `{${token}}`;
+ const next = el.value.slice(0, start) + insertion + el.value.slice(end);
+ setValue(next);
+ // Defer so React commits the new value before we move the caret.
+ requestAnimationFrame(() => {
+ const ta = textareaRef.current;
+ if (!ta) return;
+ const cursor = start + insertion.length;
+ ta.setSelectionRange(cursor, cursor);
+ ta.focus();
+ });
+ },
+ [setValue]
+ );
- const insertToken = useCallback((token: string) => {
- const el = textareaRef.current;
- if (!el) return;
- const start = el.selectionStart ?? el.value.length;
- const end = el.selectionEnd ?? el.value.length;
- const insertion = `{${token}}`;
- el.value = el.value.slice(0, start) + insertion + el.value.slice(end);
- el.dispatchEvent(new Event("input", { bubbles: true }));
- const cursor = start + insertion.length;
- el.setSelectionRange(cursor, cursor);
- el.focus();
+ // One handler for all token rows. Each item stamps its token onto
+ // `data-token`; we read it off the event target instead of allocating a
+ // fresh `() => insertToken(tok.token)` closure per item per render.
+ const handleTokenSelect = useCallback(
+ (e: MouseEvent<HTMLDivElement>) => {
+ const token = e.currentTarget.dataset.token;
+ if (token) insertToken(token);
+ },
+ [insertToken]
+ );
+
+ const syncScroll = useCallback(() => {
+ const ta = textareaRef.current;
+ const ov = overlayRef.current;
+ if (!ta || !ov) return;
+ ov.scrollTop = ta.scrollTop;
+ ov.scrollLeft = ta.scrollLeft;
}, []);
const groups = useMemo<TokenGroup[]>(() => {
@@ -120,50 +197,136 @@ export default function MessageWithTokens({
// 2. Item ctx tokens — always populated regardless of surface.
// Includes display-only tokens (`item.id`, `item.name`) on top of
// the predicate-eligible fields from `FIELD_REGISTRY`.
- const itemFields = FIELD_REGISTRY.filter((f) => f.context === "item");
const itemTokens: TokenItem[] = [
// `item.id` is the readable id (e.g. "PART-001"), not the UUID — see
// `evaluateLinesForSurface` where the ctx is normalised.
{ token: "item.id", description: "Readable ID (e.g. PART-001)" },
- { token: "item.name", description: "Display name" },
- ...itemFields.map((f) => ({ token: f.path, description: f.label }))
+ { token: "item.name", description: "Display name" }
];
+ for (const f of FIELDS_BY_CTX.item)
+ itemTokens.push({ token: f.path, description: f.label });
out.push({ heading: CONTEXT_LABELS.item, tokens: itemTokens });
// 3. Surface-relevant ctx tokens. Compute the union of ctx keys
// populated by any selected surface; hide groups no surface uses.
const allowedCtx = new Set<FieldDef["context"]>();
for (const s of surfaces) {
- for (const k of CTX_KEYS_BY_SURFACE[s] ?? []) allowedCtx.add(k);
+ const keys = CTX_KEYS_BY_SURFACE[s];
+ if (!keys) continue;
+ for (const k of keys) allowedCtx.add(k);
}
- const orderedCtx: FieldDef["context"][] = ["storage", "transaction"];
- for (const ctxKey of orderedCtx) {
+ for (const ctxKey of ORDERED_CTX) {
if (!allowedCtx.has(ctxKey)) continue;
- const fields = FIELD_REGISTRY.filter((f) => f.context === ctxKey);
+ const fields = FIELDS_BY_CTX[ctxKey];
if (fields.length === 0) continue;
- out.push({
- heading: CONTEXT_LABELS[ctxKey],
- tokens: fields.map((f) => ({
- token: f.path,
- description: f.label
- }))
- });
+ const tokens: TokenItem[] = [];
+ for (const f of fields)
+ tokens.push({ token: f.path, description: f.label });
+ out.push({ heading: CONTEXT_LABELS[ctxKey], tokens });
}
return out;
}, [conditions, surfaces]);
+ const knownTokens = useMemo(() => {
+ const set = new Set<string>();
+ for (const g of groups) for (const tok of g.tokens) set.add(tok.token);
+ return set;
+ }, [groups]);
+
+ // Single-pass element emit. Skips the intermediate `parts` array
+ // allocation, the iterator object from `matchAll`, and the per-segment
+ // shape objects. Reset `lastIndex` because `TOKEN_RE` is a shared
+ // module-scope `/g` regex.
+ const highlighted = useMemo<ReactNode[]>(() => {
+ const out: ReactNode[] = [];
+ TOKEN_RE.lastIndex = 0;
+ let last = 0;
+ let key = 0;
+ let m: RegExpExecArray | null;
+ while ((m = TOKEN_RE.exec(text)) !== null) {
+ const idx = m.index;
+ if (idx > last) out.push(text.slice(last, idx));
+ const inner = m[1] ?? "";
+ const known =
+ knownTokens.has(inner) || inner.startsWith(CUSTOM_FIELD_PREFIX);
+ out.push(
+ <mark
+ key={key++}
+ className={known ? KNOWN_TOKEN_CLS : UNKNOWN_TOKEN_CLS}
+ >
+ {m[0]}
+ </mark>
+ );
+ last = idx + m[0].length;
+ // Defensive: zero-length match would loop forever. The regex can't
+ // match empty since it requires at least `{` + ident + `}`, but the
+ // bump keeps a future regex change safe.
+ if (m[0].length === 0) TOKEN_RE.lastIndex++;
+ }
+ if (last < text.length) out.push(text.slice(last));
+ return out;
+ }, [text, knownTokens]);
+
+ // Identical typography between the overlay and the textarea — any drift
+ // here desyncs the highlighted rectangles from the rendered glyphs.
+ const sharedTypography =
+ "px-3 py-2 text-sm leading-[1.25rem] font-sans whitespace-pre-wrap break-words";
+
+ const inputProps = getInputProps<TextareaHTMLAttributes<HTMLTextAreaElement>>(
+ {
+ id: name,
+ placeholder: t`Shown to the user when this rule fails.`
+ }
+ );
+
return (
- <div className="w-full" ref={setRefFromDom}>
- <TextArea
- name={name}
- label={label ?? t`Message`}
- placeholder={t`Shown to the user when this rule fails.`}
- />
+ <FormControl isInvalid={!!error}>
+ {label && <FormLabel htmlFor={name}>{label}</FormLabel>}
+ <div className="relative w-full">
+ <div
+ ref={overlayRef}
+ aria-hidden="true"
+ // `pb-[1lh]` reserves a trailing line so the overlay's last row
+ // stays glued to the textarea's last row — without it an
+ // unterminated final line gets clipped on scroll.
+ className={cn(
+ "pointer-events-none absolute inset-0 overflow-hidden rounded-md border border-transparent text-transparent pb-[1lh]",
+ sharedTypography,
+ isDisabled && "opacity-50",
+ isReadOnly && "bg-muted"
+ )}
+ >
+ {highlighted}
+ </div>
+ <textarea
+ {...inputProps}
+ ref={textareaRef}
+ value={text}
+ onChange={(e) => {
+ setValue(e.target.value);
+ inputProps.onChange?.(e);
+ }}
+ onBlur={(e) => inputProps.onBlur?.(e)}
+ onScroll={syncScroll}
+ disabled={isDisabled}
+ readOnly={isReadOnly}
+ className={cn(
+ "relative flex min-h-[2lh] max-h-[10lh] w-full rounded-md border border-input bg-transparent ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 read-only:bg-muted read-only:cursor-not-allowed",
+ sharedTypography
+ )}
+ />
+ </div>
+ {error && <FormErrorMessage>{error}</FormErrorMessage>}
<HStack className="justify-end mt-2">
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <Button variant="ghost" size="sm" leftIcon={<LuBraces />}>
+ <Button
+ variant="ghost"
+ size="sm"
+ leftIcon={BRACES_ICON}
+ isDisabled={isLocked}
+ >
<Trans>Insert token</Trans>
</Button>
</DropdownMenuTrigger>
@@ -177,7 +340,8 @@ export default function MessageWithTokens({
{group.tokens.map((tok) => (
<DropdownMenuItem
key={tok.token}
- onClick={() => insertToken(tok.token)}
+ data-token={tok.token}
+ onClick={handleTokenSelect}
className="flex items-center gap-2"
>
<span className="font-mono text-xs">{`{${tok.token}}`}</span>
@@ -191,6 +355,6 @@ export default function MessageWithTokens({
</DropdownMenuContent>
</DropdownMenu>
</HStack>
- </div>
+ </FormControl>
);
}
diff --git a/apps/erp/app/modules/items/ui/ItemRules/SeveritySelect.tsx b/apps/erp/app/modules/items/ui/ItemRules/SeveritySelect.tsx
index ade5c6d084..a9e2bff042 100644
--- a/apps/erp/app/modules/items/ui/ItemRules/SeveritySelect.tsx
+++ b/apps/erp/app/modules/items/ui/ItemRules/SeveritySelect.tsx
@@ -26,13 +26,13 @@ export default function SeveritySelect({ name, label }: SeveritySelectProps) {
value: "error",
title: t`Error`,
description: t`Blocks save until resolved`,
- icon: <LuOctagonAlert className="text-destructive" />
+ icon: <LuOctagonAlert />
},
{
value: "warn",
title: t`Warning`,
description: t`Allows acknowledge & continue`,
- icon: <LuTriangleAlert className="text-amber-500" />
+ icon: <LuTriangleAlert />
}
];
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index 710e86d928..6fd31d60df 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -6440,7 +6440,7 @@ msgstr "Von Materialien erben"
msgid "Insert rows"
msgstr "Zeilen einfügen"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:167
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:330
msgid "Insert token"
msgstr ""
@@ -7841,7 +7841,6 @@ msgid "Members"
msgstr "Mitglieder"
#: apps/erp/app/modules/items/ui/ItemRules/ItemRuleAssignments.tsx:163
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:160
msgid "Message"
msgstr ""
@@ -12413,7 +12412,7 @@ msgstr "Zeigen Sie Teilminiaturen auf Angeboten, Verkaufsaufträgen, Verkaufsrec
msgid "Show sync options"
msgstr "Synchronisierungsoptionen anzeigen"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:161
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:279
msgid "Shown to the user when this rule fails."
msgstr ""
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index 7a65b1b0c9..5bab67cbc9 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -6440,7 +6440,7 @@ msgstr "Inherit From Materials"
msgid "Insert rows"
msgstr "Insert rows"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:167
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:330
msgid "Insert token"
msgstr "Insert token"
@@ -7841,7 +7841,6 @@ msgid "Members"
msgstr "Members"
#: apps/erp/app/modules/items/ui/ItemRules/ItemRuleAssignments.tsx:163
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:160
msgid "Message"
msgstr "Message"
@@ -12413,7 +12412,7 @@ msgstr "Show part thumbnails on quotes, sales orders, sales invoices, and shipme
msgid "Show sync options"
msgstr "Show sync options"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:161
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:279
msgid "Shown to the user when this rule fails."
msgstr "Shown to the user when this rule fails."
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index c49aa1f643..4dc05c2cbc 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -6440,7 +6440,7 @@ msgstr "Heredar de Materiales"
msgid "Insert rows"
msgstr "Insertar filas"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:167
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:330
msgid "Insert token"
msgstr ""
@@ -7841,7 +7841,6 @@ msgid "Members"
msgstr "Miembros"
#: apps/erp/app/modules/items/ui/ItemRules/ItemRuleAssignments.tsx:163
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:160
msgid "Message"
msgstr ""
@@ -12413,7 +12412,7 @@ msgstr "Mostrar miniaturas de piezas en cotizaciones, órdenes de venta, factura
msgid "Show sync options"
msgstr "Mostrar opciones de sincronización"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:161
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:279
msgid "Shown to the user when this rule fails."
msgstr ""
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index 03035b7b47..549c979aa7 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -6440,7 +6440,7 @@ msgstr "Hériter des matériaux"
msgid "Insert rows"
msgstr "Insérer des lignes"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:167
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:330
msgid "Insert token"
msgstr ""
@@ -7841,7 +7841,6 @@ msgid "Members"
msgstr "Membres"
#: apps/erp/app/modules/items/ui/ItemRules/ItemRuleAssignments.tsx:163
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:160
msgid "Message"
msgstr ""
@@ -12413,7 +12412,7 @@ msgstr "Afficher les vignettes des pièces sur les devis, les commandes de vente
msgid "Show sync options"
msgstr "Afficher les options de synchronisation"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:161
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:279
msgid "Shown to the user when this rule fails."
msgstr ""
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index 5d9af94885..69c12f6207 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -6440,7 +6440,7 @@ msgstr "सामग्री से विरासत में प्रा
msgid "Insert rows"
msgstr "पंक्तियाँ सम्मिलित करें"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:167
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:330
msgid "Insert token"
msgstr ""
@@ -7841,7 +7841,6 @@ msgid "Members"
msgstr "सदस्य"
#: apps/erp/app/modules/items/ui/ItemRules/ItemRuleAssignments.tsx:163
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:160
msgid "Message"
msgstr ""
@@ -12413,7 +12412,7 @@ msgstr "उद्धरण, बिक्री आदेश, बिक्री
msgid "Show sync options"
msgstr "सिंक विकल्प दिखाएं"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:161
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:279
msgid "Shown to the user when this rule fails."
msgstr ""
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index dbe927f1cf..498fdc0540 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -6440,7 +6440,7 @@ msgstr "Eredita dai Materiali"
msgid "Insert rows"
msgstr "Inserisci righe"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:167
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:330
msgid "Insert token"
msgstr ""
@@ -7841,7 +7841,6 @@ msgid "Members"
msgstr "Membri"
#: apps/erp/app/modules/items/ui/ItemRules/ItemRuleAssignments.tsx:163
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:160
msgid "Message"
msgstr ""
@@ -12413,7 +12412,7 @@ msgstr "Mostra le miniature delle parti su preventivi, ordini di vendita, fattur
msgid "Show sync options"
msgstr "Mostra opzioni di sincronizzazione"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:161
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:279
msgid "Shown to the user when this rule fails."
msgstr ""
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index 8b53b196d5..6a1e657a97 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -6440,7 +6440,7 @@ msgstr "材料から継承"
msgid "Insert rows"
msgstr "行を挿入"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:167
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:330
msgid "Insert token"
msgstr ""
@@ -7841,7 +7841,6 @@ msgid "Members"
msgstr "メンバー"
#: apps/erp/app/modules/items/ui/ItemRules/ItemRuleAssignments.tsx:163
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:160
msgid "Message"
msgstr ""
@@ -12413,7 +12412,7 @@ msgstr "見積書、販売注文、販売請求書、および出荷に部品の
msgid "Show sync options"
msgstr "同期オプションを表示"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:161
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:279
msgid "Shown to the user when this rule fails."
msgstr ""
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 8e5b97b75a..aa8f49e1eb 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -6440,7 +6440,7 @@ msgstr "Dziedzicz z Materiałów"
msgid "Insert rows"
msgstr "Wstaw wiersze"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:167
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:330
msgid "Insert token"
msgstr ""
@@ -7841,7 +7841,6 @@ msgid "Members"
msgstr "Członkowie"
#: apps/erp/app/modules/items/ui/ItemRules/ItemRuleAssignments.tsx:163
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:160
msgid "Message"
msgstr ""
@@ -12413,7 +12412,7 @@ msgstr "Pokaż miniatury części na ofertach, zamówieniach sprzedaży, faktura
msgid "Show sync options"
msgstr "Pokaż opcje synchronizacji"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:161
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:279
msgid "Shown to the user when this rule fails."
msgstr ""
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index fbc78e7bc1..d52318ae6c 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -6440,7 +6440,7 @@ msgstr "Herdar de Materiais"
msgid "Insert rows"
msgstr "Inserir linhas"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:167
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:330
msgid "Insert token"
msgstr ""
@@ -7841,7 +7841,6 @@ msgid "Members"
msgstr "Membros"
#: apps/erp/app/modules/items/ui/ItemRules/ItemRuleAssignments.tsx:163
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:160
msgid "Message"
msgstr ""
@@ -12413,7 +12412,7 @@ msgstr "Mostrar miniaturas de peças em cotações, pedidos de venda, faturas de
msgid "Show sync options"
msgstr "Mostrar opções de sincronização"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:161
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:279
msgid "Shown to the user when this rule fails."
msgstr ""
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index 5dce5a37d4..4770165c33 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -6440,7 +6440,7 @@ msgstr "Наследовать от материалов"
msgid "Insert rows"
msgstr "Вставить строки"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:167
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:330
msgid "Insert token"
msgstr ""
@@ -7841,7 +7841,6 @@ msgid "Members"
msgstr "Участники"
#: apps/erp/app/modules/items/ui/ItemRules/ItemRuleAssignments.tsx:163
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:160
msgid "Message"
msgstr ""
@@ -12413,7 +12412,7 @@ msgstr "Показывать миниатюры деталей на предло
msgid "Show sync options"
msgstr "Показать параметры синхронизации"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:161
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:279
msgid "Shown to the user when this rule fails."
msgstr ""
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index a4c987b047..8ff22ded47 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -6440,7 +6440,7 @@ msgstr "从材料继承"
msgid "Insert rows"
msgstr "插入行"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:167
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:330
msgid "Insert token"
msgstr ""
@@ -7841,7 +7841,6 @@ msgid "Members"
msgstr "成员"
#: apps/erp/app/modules/items/ui/ItemRules/ItemRuleAssignments.tsx:163
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:160
msgid "Message"
msgstr ""
@@ -12413,7 +12412,7 @@ msgstr "在报价单、销售订单、销售发票和发货单上显示零件缩
msgid "Show sync options"
msgstr "显示同步选项"
-#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:161
+#: apps/erp/app/modules/items/ui/ItemRules/MessageWithTokens.tsx:279
msgid "Shown to the user when this rule fails."
msgstr ""