- services/fiscal/: one driver interface (prepare_receipt / prepare_credit_note -> send,
credit_notes flag, status); the dTEC100extra folder bridge moved into txt_file.py as the
first driver, same command files. fiscal_service.py removed, callers moved.
- Refunds: models/refund.py + Alembic 0016 (refunds, refund_items; ordering.refunds for
existing owners/managers). services/refunds.py: today's business day, the cashier's open
shift, partial quantities, items from another shift need ordering.refunds or a manager's
approval (check()/authorize() return the override row). Paid items are never edited.
- POS: GET /api/pos/receipts, GET /api/pos/receipts/{id}, POST /api/pos/orders/{id}/refund
(cash opens the drawer; fiscal "manual" when the driver can't issue credit notes).
- Shift totals subtract refunds and now count discounts; day close and business-day
reports carry refunds.
- Terminal: Receipts mode (ReceiptsView, ReceiptPanel, logic/refunds.js), en/el texts.
- Tests: test_pos_refunds.py (12), terminal unit +1, terminal.mjs +7.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
709 B
Python
26 lines
709 B
Python
from fastapi import APIRouter, Depends
|
|
from pydantic import BaseModel
|
|
from sqlalchemy.orm import Session
|
|
|
|
from database import get_db
|
|
from routers.deps import require_settings_manager
|
|
from models.user import User
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
class TestFoldersRequest(BaseModel):
|
|
out_folder: str
|
|
in_folder: str
|
|
|
|
|
|
@router.post("/test-folders")
|
|
def test_folders(
|
|
body: TestFoldersRequest,
|
|
db: Session = Depends(get_db),
|
|
user: User = Depends(require_settings_manager),
|
|
):
|
|
"""Verify that both fiscal folders are accessible (read + write) from inside the container."""
|
|
from services.fiscal.txt_file import test_folders
|
|
return test_folders(body.out_folder.strip(), body.in_folder.strip())
|