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(items): say on a Draft method that new jobs use the Active version

Raul2187b18707dc
diff --git a/apps/erp/app/modules/items/ui/Item/MakeMethodTools.tsx b/apps/erp/app/modules/items/ui/Item/MakeMethodTools.tsx
index 55c5b31205..173d8f54eb 100644
--- a/apps/erp/app/modules/items/ui/Item/MakeMethodTools.tsx
+++ b/apps/erp/app/modules/items/ui/Item/MakeMethodTools.tsx
@@ -7,6 +7,7 @@ import { Number, SelectControlled, Submit, ValidatedForm } from "@carbon/form";
import { useAction } from "@carbon/query";
import {
Alert,
+ AlertDescription,
AlertTitle,
Badge,
Button,
@@ -54,6 +55,7 @@ import {
LuGitFork,
LuGitMerge,
LuGitPullRequestArrow,
+ LuInfo,
LuStar,
LuTriangleAlert
} from "react-icons/lu";
@@ -69,6 +71,7 @@ import {
getMethodValidator,
makeMethodVersionValidator
} from "../../items.models";
+import type { ChangeNoticeForItem } from "../../items.service";
import type { MakeMethod } from "../../types";
import {
CreateChangeNoticeModal,
@@ -135,6 +138,15 @@ const MakeMethodTools = ({
const activeMethod =
makeMethods.find((m) => m.id === activeMethodId) ?? makeMethods[0];
+ // New jobs take the Active version over any Draft (`activeMakeMethods`), so
+ // edits to a Draft reach them only once it is made Active.
+ const liveMethod =
+ activeMethod.status === "Draft"
+ ? makeMethods.find(
+ (m) => m.status === "Active" && m.id !== activeMethod.id
+ )
+ : undefined;
+
const maxVersion = Math.max(...makeMethods.map((m) => m.version));
const [selectedVersion, setSelectedVersion] =
useState<MakeMethod>(activeMethod);
@@ -418,6 +430,26 @@ const MakeMethodTools = ({
</HStack>
</Menubar>
+ {liveMethod && (
+ <DraftMethodNotice
+ draftVersion={activeMethod.version}
+ activeVersion={liveMethod.version}
+ isDisabled={
+ !permissions.can("update", "parts") || isChangeNoticeLocked
+ }
+ lock={{
+ changeNotices: openChangeNotices,
+ isLocked: isChangeNoticeLocked
+ }}
+ onMakeActive={() => {
+ flushSync(() => {
+ setSelectedVersion(activeMethod);
+ });
+ activeMethodModal.onOpen();
+ }}
+ />
+ )}
+
{getMethodModal.isOpen && (
<Modal
open
@@ -708,6 +740,54 @@ const MakeMethodTools = ({
);
};
+// Shown on a Draft version while another version is Active: new jobs are made
+// from the Active one, so nothing edited here reaches them yet.
+function DraftMethodNotice({
+ draftVersion,
+ activeVersion,
+ isDisabled,
+ lock,
+ onMakeActive
+}: {
+ draftVersion: number;
+ activeVersion: number;
+ isDisabled: boolean;
+ lock: { changeNotices: ChangeNoticeForItem[]; isLocked: boolean };
+ onMakeActive: () => void;
+}) {
+ return (
+ <Alert variant="info">
+ <LuInfo />
+ <AlertTitle>
+ <Trans>New jobs use version {activeVersion}</Trans>
+ </AlertTitle>
+ <AlertDescription>
+ <Trans>
+ You are editing draft version {draftVersion}. Its changes reach new
+ jobs once it is the Active version.
+ </Trans>
+ <div className="mt-2">
+ <ItemChangeNoticeLock
+ changeNotices={lock.changeNotices}
+ isLocked={lock.isLocked}
+ className="w-fit"
+ >
+ <Button
+ size="sm"
+ variant="secondary"
+ leftIcon={<LuStar />}
+ isDisabled={isDisabled}
+ onClick={onMakeActive}
+ >
+ <Trans>Make Active</Trans>
+ </Button>
+ </ItemChangeNoticeLock>
+ </div>
+ </AlertDescription>
+ </Alert>
+ );
+}
+
function AdvancedSection({
onChange
}: {
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index de4704f5b9..6b62ecb053 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -14274,6 +14274,9 @@ msgstr "Neuer Vorfall"
msgid "New Item Group"
msgstr "Neue Artikelgruppe"
+msgid "New jobs use version {activeVersion}"
+msgstr "Neue Fertigungsaufträge verwenden Version {activeVersion}"
+
msgid "New Kanban"
msgstr "Neuer Kanban"
@@ -26713,6 +26716,9 @@ msgstr "Ja, IDs aktualisieren"
msgid "You"
msgstr "Du"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "Sie bearbeiten die Entwurfsversion {draftVersion}. Ihre Änderungen gelten für neue Fertigungsaufträge, sobald sie die aktive Version ist."
+
msgid "You belong to more than one company. Pick where to work."
msgstr "Du gehörst mehr als einem Unternehmen an. Wähle aus, wo du arbeiten möchtest."
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index 5eef1d1d13..a73b253b9d 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -14274,6 +14274,9 @@ msgstr "New Issue"
msgid "New Item Group"
msgstr "New Item Group"
+msgid "New jobs use version {activeVersion}"
+msgstr "New jobs use version {activeVersion}"
+
msgid "New Kanban"
msgstr "New Kanban"
@@ -26713,6 +26716,9 @@ msgstr "Yes, Update IDs"
msgid "You"
msgstr "You"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+
msgid "You belong to more than one company. Pick where to work."
msgstr "You belong to more than one company. Pick where to work."
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index 3e67a3a822..38dcc6db27 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -14274,6 +14274,9 @@ msgstr "Nuevo Problema"
msgid "New Item Group"
msgstr "Nuevo Grupo de Artículos"
+msgid "New jobs use version {activeVersion}"
+msgstr "Las nuevas órdenes de trabajo usan la versión {activeVersion}"
+
msgid "New Kanban"
msgstr "Nuevo Kanban"
@@ -26713,6 +26716,9 @@ msgstr "Sí, Actualizar IDs"
msgid "You"
msgstr "Tú"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "Está editando la versión borrador {draftVersion}. Sus cambios llegan a las nuevas órdenes de trabajo cuando sea la versión activa."
+
msgid "You belong to more than one company. Pick where to work."
msgstr "Perteneces a más de una empresa. Elige dónde trabajar."
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index 8af07373f8..540b460e0e 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -14274,6 +14274,9 @@ msgstr "Nouveau Problème"
msgid "New Item Group"
msgstr "Nouveau groupe d'articles"
+msgid "New jobs use version {activeVersion}"
+msgstr "Les nouveaux ordres de fabrication utilisent la version {activeVersion}"
+
msgid "New Kanban"
msgstr "Nouveau Kanban"
@@ -26713,6 +26716,9 @@ msgstr "Oui, Mettre à jour les IDs"
msgid "You"
msgstr "Vous"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "Vous modifiez la version brouillon {draftVersion}. Ses modifications s'appliquent aux nouveaux ordres de fabrication une fois qu'elle est la version active."
+
msgid "You belong to more than one company. Pick where to work."
msgstr "Vous appartenez à plus d'une société. Choisissez où travailler."
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index a84cd16a2f..5528f1b62b 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -14274,6 +14274,9 @@ msgstr "नया मुद्दा"
msgid "New Item Group"
msgstr "नया आइटम समूह"
+msgid "New jobs use version {activeVersion}"
+msgstr "नए जॉब संस्करण {activeVersion} का उपयोग करते हैं"
+
msgid "New Kanban"
msgstr "नया कानबन"
@@ -26713,6 +26716,9 @@ msgstr "हाँ, आईडी अपडेट करें"
msgid "You"
msgstr "आप"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "आप ड्राफ्ट संस्करण {draftVersion} संपादित कर रहे हैं। इसके बदलाव नए जॉब तक तभी पहुँचते हैं जब यह सक्रिय संस्करण हो।"
+
msgid "You belong to more than one company. Pick where to work."
msgstr "आप एक से अधिक कंपनी से संबंधित हैं। चुनें कि कहां काम करना है।"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index dc8fa7789b..03328fa63e 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -14274,6 +14274,9 @@ msgstr "Nuovo Problema"
msgid "New Item Group"
msgstr "Nuovo Gruppo Articoli"
+msgid "New jobs use version {activeVersion}"
+msgstr "I nuovi ordini di produzione usano la versione {activeVersion}"
+
msgid "New Kanban"
msgstr "Nuovo Kanban"
@@ -26713,6 +26716,9 @@ msgstr "Sì, Aggiorna ID"
msgid "You"
msgstr "Tu"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "Stai modificando la versione bozza {draftVersion}. Le sue modifiche arrivano ai nuovi ordini di produzione quando diventa la versione attiva."
+
msgid "You belong to more than one company. Pick where to work."
msgstr "Appartieni a più di un'azienda. Scegli dove lavorare."
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index 25572248d4..4242cad7a9 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -14274,6 +14274,9 @@ msgstr "新しい問題"
msgid "New Item Group"
msgstr "新しいアイテムグループ"
+msgid "New jobs use version {activeVersion}"
+msgstr "新しい製造指図はバージョン {activeVersion} を使用します"
+
msgid "New Kanban"
msgstr "新規かんばん"
@@ -26713,6 +26716,9 @@ msgstr "はい、IDを更新"
msgid "You"
msgstr "あなた"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "下書きバージョン {draftVersion} を編集しています。変更は、このバージョンが有効になった後の新しい製造指図に反映されます。"
+
msgid "You belong to more than one company. Pick where to work."
msgstr "複数の会社に属しています。作業する会社を選択してください。"
diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.po
index 21aa3ea4cd..94588f16fd 100644
--- a/packages/locale/locales/ko/erp.po
+++ b/packages/locale/locales/ko/erp.po
@@ -14274,6 +14274,9 @@ msgstr "새 이슈"
msgid "New Item Group"
msgstr "새 품목 그룹"
+msgid "New jobs use version {activeVersion}"
+msgstr "새 작업 지시는 버전 {activeVersion}을(를) 사용합니다"
+
msgid "New Kanban"
msgstr "새 칸반"
@@ -26713,6 +26716,9 @@ msgstr "예, ID 업데이트"
msgid "You"
msgstr "나"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "초안 버전 {draftVersion}을(를) 편집하고 있습니다. 변경 사항은 이 버전이 활성 버전이 된 후 새 작업 지시에 반영됩니다."
+
msgid "You belong to more than one company. Pick where to work."
msgstr "둘 이상의 회사에 속해 있습니다. 작업할 회사를 선택하세요."
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 2bc77be862..13c716380e 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -14274,6 +14274,9 @@ msgstr "Nowy Problem"
msgid "New Item Group"
msgstr "Nowa Grupa Pozycji"
+msgid "New jobs use version {activeVersion}"
+msgstr "Nowe zlecenia produkcyjne używają wersji {activeVersion}"
+
msgid "New Kanban"
msgstr "Nowy Kanban"
@@ -26713,6 +26716,9 @@ msgstr "Tak, Aktualizuj identyfikatory"
msgid "You"
msgstr "Ty"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "Edytujesz wersję roboczą {draftVersion}. Jej zmiany trafią do nowych zleceń produkcyjnych, gdy stanie się wersją aktywną."
+
msgid "You belong to more than one company. Pick where to work."
msgstr "Należysz do więcej niż jednej firmy. Wybierz, gdzie chcesz pracować."
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index 5171af5032..9fcd812948 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -14274,6 +14274,9 @@ msgstr "Novo Problema"
msgid "New Item Group"
msgstr "Novo Grupo de Itens"
+msgid "New jobs use version {activeVersion}"
+msgstr "Novas ordens de produção usam a versão {activeVersion}"
+
msgid "New Kanban"
msgstr "Novo Kanban"
@@ -26713,6 +26716,9 @@ msgstr "Sim, Atualizar IDs"
msgid "You"
msgstr "Você"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "Você está editando a versão rascunho {draftVersion}. As alterações chegam às novas ordens de produção quando ela for a versão ativa."
+
msgid "You belong to more than one company. Pick where to work."
msgstr "Você pertence a mais de uma empresa. Escolha onde trabalhar."
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index f86d12edcc..0e1fa3fff8 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -14274,6 +14274,9 @@ msgstr "Новая проблема"
msgid "New Item Group"
msgstr "Новая группа товаров"
+msgid "New jobs use version {activeVersion}"
+msgstr "Новые производственные заказы используют версию {activeVersion}"
+
msgid "New Kanban"
msgstr "Новый канбан"
@@ -26713,6 +26716,9 @@ msgstr "Да, обновить ID"
msgid "You"
msgstr "Вы"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "Вы редактируете черновую версию {draftVersion}. Её изменения попадут в новые производственные заказы, когда она станет активной версией."
+
msgid "You belong to more than one company. Pick where to work."
msgstr "Вы принадлежите более чем одной организации. Выберите, где работать."
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index d110ececf0..c5a8d1008b 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -14274,6 +14274,9 @@ msgstr "Yeni Sorun"
msgid "New Item Group"
msgstr "Yeni Ürün Grubu"
+msgid "New jobs use version {activeVersion}"
+msgstr "Yeni iş emirleri {activeVersion} sürümünü kullanır"
+
msgid "New Kanban"
msgstr "Yeni Kanban"
@@ -26713,6 +26716,9 @@ msgstr "Evet, Kimlikleri Güncelle"
msgid "You"
msgstr "Sen"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "Taslak sürüm {draftVersion} düzenleniyor. Değişiklikleri, bu sürüm aktif sürüm olduğunda yeni iş emirlerine yansır."
+
msgid "You belong to more than one company. Pick where to work."
msgstr "Birden fazla şirkete bağlısınız. Nerede çalışmak istediğinizi seçin."
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 7f83b9f0e6..9467a45c05 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -14274,6 +14274,9 @@ msgstr "新问题"
msgid "New Item Group"
msgstr "新建项目组"
+msgid "New jobs use version {activeVersion}"
+msgstr "新工单使用版本 {activeVersion}"
+
msgid "New Kanban"
msgstr "新看板"
@@ -26713,6 +26716,9 @@ msgstr "是的,更新 ID"
msgid "You"
msgstr "你"
+msgid "You are editing draft version {draftVersion}. Its changes reach new jobs once it is the Active version."
+msgstr "您正在编辑草稿版本 {draftVersion}。其更改将在它成为启用版本后应用于新工单。"
+
msgid "You belong to more than one company. Pick where to work."
msgstr "您属于多个公司。选择在哪个公司工作。"