Backend: Verbrauchsgegenstand/Einzelstueck sind immer Gegenstaende
product_tracking leitet die Art bisher nur aus der Kategorie ab. Beim Umstellen Lebensmittel -> Verbrauchsgegenstand faellt die (Lebensmittel-)Kategorie weg, sodass der Artikel faelschlich "food" blieb und in der Lebensmittelliste hing. individual/bulk implizieren jetzt "object", unabhaengig von der Kategorie. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,14 @@ def product_tracking(db: Session, product: Product) -> str:
|
||||
Ohne Kategorie gilt "food" – so bleibt das Verhalten bestehender
|
||||
(reiner Lebensmittel-)Installationen unverändert. Ein Artikel in einer
|
||||
Gegenstands-Kategorie wird als "object" geführt.
|
||||
|
||||
Einzelstücke und Verbrauchsgegenstände sind immer Gegenstände: Diese Arten
|
||||
gibt es nur bei Gegenständen, sie werden aber (anders als "Menge je Lagerort")
|
||||
über ein Flag am Artikel geführt. So bleibt ein als Verbrauchsgegenstand
|
||||
umgestellter Artikel auch ohne (Gegenstands-)Kategorie ein Gegenstand.
|
||||
"""
|
||||
if product.individual or product.bulk:
|
||||
return CategoryTracking.object.value
|
||||
if product.category_id is None:
|
||||
return CategoryTracking.food.value
|
||||
cat = product.category or db.get(Category, product.category_id)
|
||||
|
||||
Reference in New Issue
Block a user