Web: Mindestbestand nur fuer Charge-Artikel (Lebensmittel + Verbrauchsgegenstand)
Menge je Lagerort und Einzelstuecke haben keinen Mindestbestand mehr: die "Mindestbestand (Stueck)"-Felder und der je-Lagerort-Block fallen im Formular weg (Gruppe fuer Menge bleibt), Alt-Werte werden beim Speichern geleert. Die Mindestbestaende-Seite und der "+ hinzufuegen"-Dialog zeigen nur noch Charge-Artikel. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,9 @@ import { fmt } from "../units";
|
||||
// echte Einheit um. dispFactor = Basiseinheiten je Anzeigeeinheit.
|
||||
const dispFactor = (p) => (p.unit_factor && p.unit_factor > 0 ? p.unit_factor : 1);
|
||||
const dispLabel = (p) => (p.unit_name || "Stück");
|
||||
// Mindestbestand gibt es nur bei Charge-Artikeln: Lebensmittel und
|
||||
// Verbrauchsgegenstände (bulk). „Menge je Lagerort" und Einzelstücke nicht.
|
||||
const canHaveMin = (p) => p.tracking !== "object" || p.bulk === true;
|
||||
// Artikeleinheit (Packung, sonst Anzeigeeinheit): nur noch nötig, um die je-Lagerort-
|
||||
// Mindestbestände umzurechnen, die in Artikeleinheiten gespeichert sind.
|
||||
const articleUnit = (p) => (p.package_size && p.package_size > 0 ? p.package_size : (p.unit_factor || 1));
|
||||
@@ -50,7 +53,7 @@ export default function MinStock() {
|
||||
|
||||
const rows = useMemo(() => {
|
||||
const out = [];
|
||||
for (const p of products) {
|
||||
for (const p of products.filter(canHaveMin)) {
|
||||
out.push({
|
||||
key: `p:${p.id}:global`, kind: "product", scope: "global", entity: p,
|
||||
name: p.name, catId: p.category_id, ort: "(Gesamt)",
|
||||
@@ -235,7 +238,7 @@ export default function MinStock() {
|
||||
<select value={draft.targetId} onChange={(e) => setDraft({ ...draft, targetId: e.target.value })}>
|
||||
<option value="">– wählen –</option>
|
||||
{(draft.kind === "product"
|
||||
? [...products].sort((a, b) => a.name.localeCompare(b.name, "de"))
|
||||
? products.filter(canHaveMin).sort((a, b) => a.name.localeCompare(b.name, "de"))
|
||||
: [...groups].sort((a, b) => a.name.localeCompare(b.name, "de"))
|
||||
).map((t) => (
|
||||
<option key={t.id} value={t.id}>
|
||||
|
||||
Reference in New Issue
Block a user