bober-bbq-bot/bot/services
byrsapty 699a73c8a0 Add per-100g product pricing and editable order line prices
Some items (grilled shashlik) can't have a flat price since the cooked
weight varies. Product gains pricing_mode ("fixed"/"per_100g") and
reference_weight_g; Product.effective_unit_price computes an estimated
per-unit charge (price-per-100g * reference_weight_g / 100) that every
cart/order call site now reads instead of raw Product.price, so the
customer sees a ready "≈" estimate everywhere (menu, cart, checkout) with
zero changes to the actual cart/checkout math.

Also adds a general per-line price override to the admin order create/edit
forms (unit_price), so staff can correct the charged amount after weighing
an item — for any product, not just weight-priced ones. This incidentally
fixes an existing bug where editing an order for an unrelated reason (e.g.
a phone number) silently re-snapshotted every line item to today's catalog
price instead of preserving what was actually charged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-03 20:33:04 +03:00
..
__init__.py Initial commit: Bober BBQ Telegram bot + backend + admin + Mini App 2026-08-08 15:50:50 +03:00
cart_service.py Add per-100g product pricing and editable order line prices 2026-09-03 20:33:04 +03:00
order_service.py Add per-100g product pricing and editable order line prices 2026-09-03 20:33:04 +03:00