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.

code review fixes

aashu20f666a5c4fb
diff --git a/apps/erp/app/components/Form/Item.tsx b/apps/erp/app/components/Form/Item.tsx
index e261ad0746..a11c11faf9 100644
--- a/apps/erp/app/components/Form/Item.tsx
+++ b/apps/erp/app/components/Form/Item.tsx
@@ -201,7 +201,7 @@ const Item = ({
? "consumable"
: "item";
- const emptyMessage = useEmptyState(entityKey, {
+ const storeEmptyMessage = useEmptyState(entityKey, {
onCreate: () => {
if (type === "Item") {
selectTypeModal.onOpen();
@@ -210,6 +210,10 @@ const Item = ({
}
}
});
+ // Only surface the empty state when the underlying store has no items at all
+ // — when filters (validItemTypes, replenishmentSystem, whitelist, …) narrow
+ // to zero, fall back to the bare empty list so the CTA doesn't mislead.
+ const emptyMessage = items.length === 0 ? storeEmptyMessage : undefined;
return (
<>
diff --git a/apps/erp/app/components/Form/Items.tsx b/apps/erp/app/components/Form/Items.tsx
index d1fb35fd74..fc9c3d14b4 100644
--- a/apps/erp/app/components/Form/Items.tsx
+++ b/apps/erp/app/components/Form/Items.tsx
@@ -65,9 +65,12 @@ const Items = (props: ItemsSelectProps) => {
triggerRef.current?.click();
};
- const emptyMessage = useEmptyState("item", {
+ const storeEmptyMessage = useEmptyState("item", {
onCreate: () => selectTypeModal.onOpen()
});
+ // Suppress when the store has inactive items but no active ones (filter
+ // narrowed to zero) — see Item.tsx for the same pattern.
+ const emptyMessage = items.length === 0 ? storeEmptyMessage : undefined;
return (
<>
diff --git a/apps/erp/app/components/Form/Shape.tsx b/apps/erp/app/components/Form/Shape.tsx
index c592f2b7ea..f951f41dc8 100644
--- a/apps/erp/app/components/Form/Shape.tsx
+++ b/apps/erp/app/components/Form/Shape.tsx
@@ -35,7 +35,7 @@ const Shape = (props: ShapeSelectProps) => {
onCreate: () => newShapeModal.onOpen()
});
- return permissions.can("create", "inventory") ? (
+ return permissions.can("create", "parts") ? (
<>
<CreatableCombobox
ref={triggerRef}
diff --git a/apps/erp/app/components/Form/StorageUnit.tsx b/apps/erp/app/components/Form/StorageUnit.tsx
index a568318928..cd84a8419f 100644
--- a/apps/erp/app/components/Form/StorageUnit.tsx
+++ b/apps/erp/app/components/Form/StorageUnit.tsx
@@ -216,7 +216,7 @@ function useNewStorageUnitModal(locationId?: string | null) {
modal.onOpen();
};
- return { triggerRef, onCreateOption, node };
+ return { triggerRef, onCreateOption, onOpen: modal.onOpen, node };
}
const storageUnitPreview = (
@@ -279,15 +279,13 @@ function StorageUnit({
onChange
}: StorageUnitProps) {
const options = useStorageUnitLeafOptions(locationId, itemId);
- const { triggerRef, onCreateOption, node } =
+ const { triggerRef, onCreateOption, onOpen, node } =
useNewStorageUnitModal(locationId);
const readOnly = isReadOnly || disabled;
const emptyMessage = useEmptyState(
"storageUnit",
- allowCreate && locationId
- ? { onCreate: () => onCreateOption("") }
- : undefined
+ allowCreate && locationId ? { onCreate: onOpen } : undefined
);
if (name) {
diff --git a/apps/erp/app/components/Form/Substance.tsx b/apps/erp/app/components/Form/Substance.tsx
index 2b15c6d292..102602dfce 100644
--- a/apps/erp/app/components/Form/Substance.tsx
+++ b/apps/erp/app/components/Form/Substance.tsx
@@ -35,7 +35,7 @@ const Substance = (props: SubstanceSelectProps) => {
onCreate: () => newSubstanceModal.onOpen()
});
- return permissions.can("create", "inventory") ? (
+ return permissions.can("create", "parts") ? (
<>
<CreatableCombobox
ref={triggerRef}
diff --git a/apps/erp/app/components/Form/Tags.tsx b/apps/erp/app/components/Form/Tags.tsx
index 58577edcfe..a2aaf51dd3 100644
--- a/apps/erp/app/components/Form/Tags.tsx
+++ b/apps/erp/app/components/Form/Tags.tsx
@@ -6,7 +6,6 @@ import { LuTags } from "react-icons/lu";
import { useFetcher } from "react-router";
import type { action } from "~/routes/x+/settings+/tags.new";
import { path } from "~/utils/path";
-import { useEmptyState } from "./emptyStates";
type TagsSelectProps = Omit<
CreatableMultiSelectProps,
@@ -58,8 +57,6 @@ const Tags = ({ table, availableTags, ...props }: TagsSelectProps) => {
[availableTags]
);
- const emptyMessage = useEmptyState("tag");
-
return (
<CreatableMultiSelect
label={props?.label ?? "Tag"}
@@ -68,7 +65,6 @@ const Tags = ({ table, availableTags, ...props }: TagsSelectProps) => {
showCreateOptionOnEmpty={false}
inline={props.inline ? TagsPreview : undefined}
inlineIcon={<LuTags />}
- emptyMessage={emptyMessage}
onCreateOption={(option) => {
if (!option) return;
diff --git a/apps/erp/app/components/Form/emptyStates.tsx b/apps/erp/app/components/Form/emptyStates.tsx
index 84640e0ca0..aa4829f6ba 100644
--- a/apps/erp/app/components/Form/emptyStates.tsx
+++ b/apps/erp/app/components/Form/emptyStates.tsx
@@ -49,7 +49,6 @@ export type EntityKey =
| "supplierLocation"
| "supplierProcess"
| "item"
- | "tag"
| "gauge"
| "storageUnit"
| "unitOfMeasure"
@@ -350,15 +349,6 @@ const useEntityCopy = (entity: EntityKey): EntityCopy => {
pluralNoun: t`items`,
moduleLabel: t`parts`
};
- case "tag":
- return {
- module: "settings",
- action: "create",
- route: path.to.tags,
- noun: t`tag`,
- pluralNoun: t`tags`,
- moduleLabel: t`settings`
- };
case "gauge":
return {
module: "quality",
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index b0110552c5..28664f92a5 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -7492,9 +7492,6 @@ msgstr "Version {0} als aktive Version festlegen?"
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "Legen Sie Ihren Standardort in den Profileinstellungen fest, um eine Lagereinheit auszuwählen."
-msgid "settings"
-msgstr ""
-
msgid "Settings"
msgstr "Einstellungen"
@@ -8148,12 +8145,6 @@ msgstr "Tabelle"
msgid "Table actions"
msgstr "Tabellenaktionen"
-msgid "tag"
-msgstr ""
-
-msgid "tags"
-msgstr ""
-
msgid "Tags"
msgstr "Tags"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index 3964525f03..9c2acbeef1 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -7492,9 +7492,6 @@ msgstr "Set Version {0} as Active Version?"
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "Set your default location in profile settings to pick a storage unit."
-msgid "settings"
-msgstr "settings"
-
msgid "Settings"
msgstr "Settings"
@@ -8148,12 +8145,6 @@ msgstr "Table"
msgid "Table actions"
msgstr "Table actions"
-msgid "tag"
-msgstr "tag"
-
-msgid "tags"
-msgstr "tags"
-
msgid "Tags"
msgstr "Tags"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index a90d0006d6..35b75e1112 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -7492,9 +7492,6 @@ msgstr "¿Establecer la versión {0} como versión activa?"
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "Establece tu ubicación predeterminada en la configuración del perfil para seleccionar una unidad de almacenamiento."
-msgid "settings"
-msgstr ""
-
msgid "Settings"
msgstr "Configuración"
@@ -8148,12 +8145,6 @@ msgstr "Tabla"
msgid "Table actions"
msgstr "Acciones de tabla"
-msgid "tag"
-msgstr ""
-
-msgid "tags"
-msgstr ""
-
msgid "Tags"
msgstr "Etiquetas"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index 1bda40d9be..cf94c3ee41 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -7492,9 +7492,6 @@ msgstr "Définir la version {0} comme version active ?"
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "Définissez votre emplacement par défaut dans les paramètres de profil pour sélectionner une unité de stockage."
-msgid "settings"
-msgstr ""
-
msgid "Settings"
msgstr "Paramètres"
@@ -8148,12 +8145,6 @@ msgstr "Tableau"
msgid "Table actions"
msgstr "Actions du tableau"
-msgid "tag"
-msgstr ""
-
-msgid "tags"
-msgstr ""
-
msgid "Tags"
msgstr "Étiquettes"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index 1db2dd02a4..dc20e205fa 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -7492,9 +7492,6 @@ msgstr "संस्करण {0} को सक्रिय संस्कर
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "अपनी डिफ़ॉल्ट स्थान को प्रोफ़ाइल सेटिंग्स में सेट करें स्टोरेज यूनिट चुनने के लिए।"
-msgid "settings"
-msgstr ""
-
msgid "Settings"
msgstr "सेटिंग्स"
@@ -8148,12 +8145,6 @@ msgstr "तालिका"
msgid "Table actions"
msgstr "तालिका क्रियाएं"
-msgid "tag"
-msgstr ""
-
-msgid "tags"
-msgstr ""
-
msgid "Tags"
msgstr "टैग"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index 93ae3945f4..d6a49e4f84 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -7492,9 +7492,6 @@ msgstr "Imposta la versione {0} come versione attiva?"
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "Imposta la tua posizione predefinita nelle impostazioni del profilo per selezionare un'unità di archiviazione."
-msgid "settings"
-msgstr ""
-
msgid "Settings"
msgstr "Impostazioni"
@@ -8148,12 +8145,6 @@ msgstr "Tabella"
msgid "Table actions"
msgstr "Azioni tabella"
-msgid "tag"
-msgstr ""
-
-msgid "tags"
-msgstr ""
-
msgid "Tags"
msgstr "Etichette"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index 6eacacf787..af8c8424a9 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -7492,9 +7492,6 @@ msgstr "バージョン {0} をアクティブバージョンとして設定し
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "プロフィール設定でデフォルトの場所を設定して、保管ユニットを選択してください。"
-msgid "settings"
-msgstr ""
-
msgid "Settings"
msgstr "設定"
@@ -8148,12 +8145,6 @@ msgstr "テーブル"
msgid "Table actions"
msgstr "テーブルアクション"
-msgid "tag"
-msgstr ""
-
-msgid "tags"
-msgstr ""
-
msgid "Tags"
msgstr "タグ"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index c052a382af..932a597103 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -7492,9 +7492,6 @@ msgstr "Ustawić wersję {0} jako aktywną wersję?"
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "Ustaw swoją domyślną lokalizację w ustawieniach profilu, aby wybrać jednostkę magazynową."
-msgid "settings"
-msgstr ""
-
msgid "Settings"
msgstr "Ustawienia"
@@ -8148,12 +8145,6 @@ msgstr "Tabela"
msgid "Table actions"
msgstr "Akcje tabeli"
-msgid "tag"
-msgstr ""
-
-msgid "tags"
-msgstr ""
-
msgid "Tags"
msgstr "Tagi"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index 44131a19c2..a6d9f96f33 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -7492,9 +7492,6 @@ msgstr "Definir Versão {0} como Versão Ativa?"
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "Defina sua localização padrão nas configurações de perfil para escolher uma unidade de armazenamento."
-msgid "settings"
-msgstr ""
-
msgid "Settings"
msgstr "Configurações"
@@ -8148,12 +8145,6 @@ msgstr "Tabela"
msgid "Table actions"
msgstr "Ações da tabela"
-msgid "tag"
-msgstr ""
-
-msgid "tags"
-msgstr ""
-
msgid "Tags"
msgstr "Etiquetas"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index 3f62d123b0..b3c0afdba9 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -7492,9 +7492,6 @@ msgstr "Установить версию {0} как активную верси
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "Установите местоположение по умолчанию в настройках профиля, чтобы выбрать единицу хранения."
-msgid "settings"
-msgstr ""
-
msgid "Settings"
msgstr "Параметры"
@@ -8148,12 +8145,6 @@ msgstr "Таблица"
msgid "Table actions"
msgstr "Действия таблицы"
-msgid "tag"
-msgstr ""
-
-msgid "tags"
-msgstr ""
-
msgid "Tags"
msgstr "Теги"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index 1763476948..2b0e5a4b2b 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -7492,9 +7492,6 @@ msgstr "Sürüm {0}\"ü Aktif Sürüm Olarak Ayarla?"
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "Bir depolama birimi seçmek için varsayılan konumunuzu profil ayarlarınızda belirleyin."
-msgid "settings"
-msgstr ""
-
msgid "Settings"
msgstr "Ayarlar"
@@ -8148,12 +8145,6 @@ msgstr "Tablo"
msgid "Table actions"
msgstr "Tablo işlemleri"
-msgid "tag"
-msgstr ""
-
-msgid "tags"
-msgstr ""
-
msgid "Tags"
msgstr "Etiketler"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 65ec2c7012..755e7b74a6 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -7492,9 +7492,6 @@ msgstr "将版本 {0} 设置为活跃版本?"
msgid "Set your default location in profile settings to pick a storage unit."
msgstr "在个人资料设置中设置默认位置以选择存储单位。"
-msgid "settings"
-msgstr ""
-
msgid "Settings"
msgstr "设置"
@@ -8148,12 +8145,6 @@ msgstr "表"
msgid "Table actions"
msgstr "表格操作"
-msgid "tag"
-msgstr ""
-
-msgid "tags"
-msgstr ""
-
msgid "Tags"
msgstr "标签"