feat: sales points, offerings and prices per sales point (platform-v2 phase 3S, step S.1)

- core/sales_points.py: in_store, in_store_takeaway, qr_table, online_takeaway,
  online_delivery, online_preorder (+ old channel names mapped).
- Alembic 0017: orders.sales_point (backfilled), products.sold_at (from digital_visible),
  digital_price/digital_discount -> item price modifiers for the QR menu and online,
  order_channel conditions -> sales points; drops the three digital columns.
- Every order records its sales point; the pricing engine's channel is it; items not sold
  there are refused (order.not_sold_here, pos.line_invalid not_sold_here).
- POS menu: only what the counter sells, prices per counter sales point; the screen shows
  the order type's products and prices. Waiter app asks for in-person products.
- Cloud snapshot: products sold by the customer apps, priced by the engine.
- Manager: product "Where it's sold" tab; pricing condition shows sales points.
- Products API, catalogue export/import carry sold_at.
- Tests: test_sales_points.py (8, incl. the migration), access +1, terminal +1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 11:00:40 +02:00
co-authored by Claude Opus 5.5
parent f2182dcb37
commit 1b468fe44b
30 changed files with 700 additions and 156 deletions
+1
View File
@@ -22,6 +22,7 @@ class Order(Base):
kds_status = Column(String, default="pending", nullable=False) # pending|preparing|done
kds_status_changed_at = Column(UTCDateTime, nullable=True)
order_type = Column(String, default="here", nullable=False) # here|takeaway|delivery
sales_point = Column(String, default="in_store", nullable=False) # core/sales_points.py (phase 3S)
# Xenia Connect — online order fields
source = Column(String, default="pos", nullable=False) # "pos" | "online"
+1 -1
View File
@@ -89,7 +89,7 @@ class PriceModifierCondition(Base):
min_item_quantity {"min": N} (this product's qty in cart)
min_category_qty {"category_id": N, "min": N} (items in category in cart)
min_order_value {"min": 0.00} (cart total before modifiers)
order_channel {"channels": ["pos","online","qr","takeaway"]}
order_channel {"channels": [sales point, ...]} (core/sales_points.py; phase 3S)
price_group_active {"price_group_id": N}
user_tier {"tiers": ["bronze","silver","gold"]} (placeholder, needs user accounts)
low_stock {"threshold": N} (placeholder, needs inventory)
+8 -4
View File
@@ -1,6 +1,9 @@
from sqlalchemy import Column, Integer, String, Boolean, Float, ForeignKey, Text
from sqlalchemy.orm import relationship
from database import Base
from core.sales_points import ALL as _SALES_POINTS, dump as _dump_sales_points
_ALL_SALES_POINTS = _dump_sales_points(_SALES_POINTS)
class Category(Base):
@@ -42,13 +45,14 @@ class Product(Base):
image_url = Column(String, nullable=True)
sort_order = Column(Integer, default=0, nullable=False)
# Xenia Connect — digital menu overrides
digital_visible = Column(Integer, default=1, nullable=False)
# Where it's sold (phase 3S): JSON list of sales points (core/sales_points.py). Prices
# per sales point are price modifiers (condition order_channel), not columns.
sold_at = Column(Text, nullable=False, default=_ALL_SALES_POINTS)
# Xenia Connect — what the customer apps show (name, text, picture); digital_available =
# orderable online right now (a temporary switch, like is_available)
digital_available = Column(Integer, default=1, nullable=False)
digital_name = Column(String, nullable=True)
digital_description = Column(String, nullable=True)
digital_price = Column(Float, nullable=True)
digital_discount = Column(Float, default=0.0, nullable=False)
digital_image_url = Column(String, nullable=True)
# sha256 of the image_url file last successfully pushed to the cloud — lets
# cloud_sync skip re-uploading unchanged images on every sync tick