Add supplier and imporve inventory frontend
This commit is contained in:
@@ -18,84 +18,84 @@ from shared.database.base import Base
|
||||
|
||||
class SupplierType(enum.Enum):
|
||||
"""Types of suppliers"""
|
||||
INGREDIENTS = "ingredients" # Raw materials supplier
|
||||
PACKAGING = "packaging" # Packaging materials
|
||||
EQUIPMENT = "equipment" # Bakery equipment
|
||||
SERVICES = "services" # Service providers
|
||||
UTILITIES = "utilities" # Utilities (gas, electricity)
|
||||
MULTI = "multi" # Multi-category supplier
|
||||
ingredients = "ingredients" # Raw materials supplier
|
||||
packaging = "packaging" # Packaging materials
|
||||
equipment = "equipment" # Bakery equipment
|
||||
services = "services" # Service providers
|
||||
utilities = "utilities" # Utilities (gas, electricity)
|
||||
multi = "multi" # Multi-category supplier
|
||||
|
||||
|
||||
class SupplierStatus(enum.Enum):
|
||||
"""Supplier lifecycle status"""
|
||||
ACTIVE = "active"
|
||||
INACTIVE = "inactive"
|
||||
PENDING_APPROVAL = "pending_approval"
|
||||
SUSPENDED = "suspended"
|
||||
BLACKLISTED = "blacklisted"
|
||||
active = "active"
|
||||
inactive = "inactive"
|
||||
pending_approval = "pending_approval"
|
||||
suspended = "suspended"
|
||||
blacklisted = "blacklisted"
|
||||
|
||||
|
||||
class PaymentTerms(enum.Enum):
|
||||
"""Payment terms with suppliers"""
|
||||
CASH_ON_DELIVERY = "cod"
|
||||
NET_15 = "net_15"
|
||||
NET_30 = "net_30"
|
||||
NET_45 = "net_45"
|
||||
NET_60 = "net_60"
|
||||
PREPAID = "prepaid"
|
||||
CREDIT_TERMS = "credit_terms"
|
||||
cod = "cod"
|
||||
net_15 = "net_15"
|
||||
net_30 = "net_30"
|
||||
net_45 = "net_45"
|
||||
net_60 = "net_60"
|
||||
prepaid = "prepaid"
|
||||
credit_terms = "credit_terms"
|
||||
|
||||
|
||||
class PurchaseOrderStatus(enum.Enum):
|
||||
"""Purchase order lifecycle status"""
|
||||
DRAFT = "draft"
|
||||
PENDING_APPROVAL = "pending_approval"
|
||||
APPROVED = "approved"
|
||||
SENT_TO_SUPPLIER = "sent_to_supplier"
|
||||
CONFIRMED = "confirmed"
|
||||
PARTIALLY_RECEIVED = "partially_received"
|
||||
COMPLETED = "completed"
|
||||
CANCELLED = "cancelled"
|
||||
DISPUTED = "disputed"
|
||||
draft = "draft"
|
||||
pending_approval = "pending_approval"
|
||||
approved = "approved"
|
||||
sent_to_supplier = "sent_to_supplier"
|
||||
confirmed = "confirmed"
|
||||
partially_received = "partially_received"
|
||||
completed = "completed"
|
||||
cancelled = "cancelled"
|
||||
disputed = "disputed"
|
||||
|
||||
|
||||
class DeliveryStatus(enum.Enum):
|
||||
"""Delivery status tracking"""
|
||||
SCHEDULED = "scheduled"
|
||||
IN_TRANSIT = "in_transit"
|
||||
OUT_FOR_DELIVERY = "out_for_delivery"
|
||||
DELIVERED = "delivered"
|
||||
PARTIALLY_DELIVERED = "partially_delivered"
|
||||
FAILED_DELIVERY = "failed_delivery"
|
||||
RETURNED = "returned"
|
||||
scheduled = "scheduled"
|
||||
in_transit = "in_transit"
|
||||
out_for_delivery = "out_for_delivery"
|
||||
delivered = "delivered"
|
||||
partially_delivered = "partially_delivered"
|
||||
failed_delivery = "failed_delivery"
|
||||
returned = "returned"
|
||||
|
||||
|
||||
class QualityRating(enum.Enum):
|
||||
"""Quality rating scale"""
|
||||
EXCELLENT = 5
|
||||
GOOD = 4
|
||||
AVERAGE = 3
|
||||
POOR = 2
|
||||
VERY_POOR = 1
|
||||
excellent = 5
|
||||
good = 4
|
||||
average = 3
|
||||
poor = 2
|
||||
very_poor = 1
|
||||
|
||||
|
||||
class DeliveryRating(enum.Enum):
|
||||
"""Delivery performance rating scale"""
|
||||
EXCELLENT = 5
|
||||
GOOD = 4
|
||||
AVERAGE = 3
|
||||
POOR = 2
|
||||
VERY_POOR = 1
|
||||
excellent = 5
|
||||
good = 4
|
||||
average = 3
|
||||
poor = 2
|
||||
very_poor = 1
|
||||
|
||||
|
||||
class InvoiceStatus(enum.Enum):
|
||||
"""Invoice processing status"""
|
||||
PENDING = "pending"
|
||||
APPROVED = "approved"
|
||||
PAID = "paid"
|
||||
OVERDUE = "overdue"
|
||||
DISPUTED = "disputed"
|
||||
CANCELLED = "cancelled"
|
||||
pending = "pending"
|
||||
approved = "approved"
|
||||
paid = "paid"
|
||||
overdue = "overdue"
|
||||
disputed = "disputed"
|
||||
cancelled = "cancelled"
|
||||
|
||||
|
||||
class Supplier(Base):
|
||||
@@ -113,7 +113,7 @@ class Supplier(Base):
|
||||
|
||||
# Supplier classification
|
||||
supplier_type = Column(SQLEnum(SupplierType), nullable=False, index=True)
|
||||
status = Column(SQLEnum(SupplierStatus), nullable=False, default=SupplierStatus.PENDING_APPROVAL, index=True)
|
||||
status = Column(SQLEnum(SupplierStatus), nullable=False, default=SupplierStatus.pending_approval, index=True)
|
||||
|
||||
# Contact information
|
||||
contact_person = Column(String(200), nullable=True)
|
||||
@@ -131,7 +131,7 @@ class Supplier(Base):
|
||||
country = Column(String(100), nullable=True)
|
||||
|
||||
# Business terms
|
||||
payment_terms = Column(SQLEnum(PaymentTerms), nullable=False, default=PaymentTerms.NET_30)
|
||||
payment_terms = Column(SQLEnum(PaymentTerms), nullable=False, default=PaymentTerms.net_30)
|
||||
credit_limit = Column(Numeric(12, 2), nullable=True)
|
||||
currency = Column(String(3), nullable=False, default="EUR") # ISO currency code
|
||||
|
||||
@@ -246,7 +246,7 @@ class PurchaseOrder(Base):
|
||||
reference_number = Column(String(100), nullable=True) # Internal reference
|
||||
|
||||
# Order status and workflow
|
||||
status = Column(SQLEnum(PurchaseOrderStatus), nullable=False, default=PurchaseOrderStatus.DRAFT, index=True)
|
||||
status = Column(SQLEnum(PurchaseOrderStatus), nullable=False, default=PurchaseOrderStatus.draft, index=True)
|
||||
priority = Column(String(20), nullable=False, default="normal") # urgent, high, normal, low
|
||||
|
||||
# Order details
|
||||
@@ -363,7 +363,7 @@ class Delivery(Base):
|
||||
supplier_delivery_note = Column(String(100), nullable=True) # Supplier's delivery reference
|
||||
|
||||
# Delivery status and tracking
|
||||
status = Column(SQLEnum(DeliveryStatus), nullable=False, default=DeliveryStatus.SCHEDULED, index=True)
|
||||
status = Column(SQLEnum(DeliveryStatus), nullable=False, default=DeliveryStatus.scheduled, index=True)
|
||||
|
||||
# Scheduling and timing
|
||||
scheduled_date = Column(DateTime(timezone=True), nullable=True)
|
||||
@@ -517,7 +517,7 @@ class SupplierInvoice(Base):
|
||||
supplier_invoice_number = Column(String(100), nullable=False)
|
||||
|
||||
# Invoice status and dates
|
||||
status = Column(SQLEnum(InvoiceStatus), nullable=False, default=InvoiceStatus.PENDING, index=True)
|
||||
status = Column(SQLEnum(InvoiceStatus), nullable=False, default=InvoiceStatus.pending, index=True)
|
||||
invoice_date = Column(DateTime(timezone=True), nullable=False)
|
||||
due_date = Column(DateTime(timezone=True), nullable=False)
|
||||
received_date = Column(DateTime(timezone=True), nullable=False, default=lambda: datetime.now(timezone.utc))
|
||||
|
||||
Reference in New Issue
Block a user