Add supplier and imporve inventory frontend

This commit is contained in:
Urtzi Alfaro
2025-09-18 23:32:53 +02:00
parent ae77a0e1c5
commit d61056df33
40 changed files with 2022 additions and 629 deletions

View File

@@ -106,7 +106,6 @@ class Ingredient(Base):
# Product details
description = Column(Text, nullable=True)
brand = Column(String(100), nullable=True) # Brand or central baker name
supplier_name = Column(String(200), nullable=True) # Central baker or distributor
unit_of_measure = Column(SQLEnum(UnitOfMeasure), nullable=False)
package_size = Column(Float, nullable=True) # Size per package/unit
@@ -158,7 +157,6 @@ class Ingredient(Base):
Index('idx_ingredients_ingredient_category', 'tenant_id', 'ingredient_category', 'is_active'),
Index('idx_ingredients_product_category', 'tenant_id', 'product_category', 'is_active'),
Index('idx_ingredients_stock_levels', 'tenant_id', 'low_stock_threshold', 'reorder_point'),
Index('idx_ingredients_central_baker', 'tenant_id', 'supplier_name', 'product_type'),
)
def to_dict(self) -> Dict[str, Any]:
@@ -194,7 +192,6 @@ class Ingredient(Base):
'subcategory': self.subcategory,
'description': self.description,
'brand': self.brand,
'supplier_name': self.supplier_name,
'unit_of_measure': self.unit_of_measure.value if self.unit_of_measure else None,
'package_size': self.package_size,
'average_cost': float(self.average_cost) if self.average_cost else None,
@@ -230,6 +227,9 @@ class Stock(Base):
tenant_id = Column(UUID(as_uuid=True), nullable=False, index=True)
ingredient_id = Column(UUID(as_uuid=True), ForeignKey('ingredients.id'), nullable=False, index=True)
# Supplier association
supplier_id = Column(UUID(as_uuid=True), nullable=True, index=True)
# Stock identification
batch_number = Column(String(100), nullable=True, index=True)
lot_number = Column(String(100), nullable=True, index=True)