feat(pos): refunds at the counter on a fiscal driver layer (platform-v2 3.3e)

- 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>
This commit is contained in:
2026-11-15 09:44:17 +02:00
co-authored by Claude Opus 5.5
parent d542cf7d34
commit f2182dcb37
32 changed files with 1486 additions and 169 deletions
+5
View File
@@ -91,5 +91,10 @@
"online": {
"not_found": "Online order {{order_id}} not found.",
"status_changed": "This online order was changed on another screen in the meantime. Check where it is now."
},
"refund": {
"invalid": "This refund doesn't add up ({{reason}}).",
"too_old": "Only payments from today's business day can be refunded at the counter.",
"items_changed": "Some of these items were refunded in the meantime. Check the order and try again."
}
}
+2 -1
View File
@@ -290,7 +290,8 @@
},
"business_day": {
"manage": "Open and close the business day"
}
},
"refunds": "Refund payments from other shifts"
}
},
"pos_counter": {
+60 -1
View File
@@ -242,7 +242,8 @@
"label": "Counter mode",
"sale": "Sale",
"tables": "Tables",
"online": "Online"
"online": "Online",
"receipts": "Receipts"
},
"tables": {
"none": "No tables for you",
@@ -349,6 +350,64 @@
},
"keep": "Keep it",
"rejectConfirm": "Reject order"
},
"receipts": {
"scope": {
"mine": "My shift",
"all": "Everyone today"
},
"empty": {
"mine": "Nothing paid in your shift yet",
"all": "Nothing paid today yet"
},
"emptyBody": "Paid orders show here, so you can give money back for them.",
"pick": "Pick a paid order to refund it",
"refunded": "{{amount}} given back"
},
"refund": {
"all": "Everything",
"tapItems": "Tap the items going back.",
"notToday": "From an earlier day: refunds at the counter are for today's payments only.",
"alreadyBack": "{{qty}} already given back",
"howMany": "How many",
"history": "Given back",
"approvedBy": "approved by {{name}}",
"fiscalManualShort": "credit note by hand",
"method": "Give back by",
"by": {
"cash": "Cash",
"card": "Card"
},
"reason": "Reason",
"reasons": {
"wrong": "Wrong item",
"quality": "Not good",
"changed": "Changed their mind",
"other": "Other…"
},
"approval": "Paid in another shift: a manager approves.",
"start": "Refund {{amount}}",
"confirmTitle": {
"cash": "Give back {{amount}} in cash?",
"card": "Give back {{amount}} to the card?"
},
"confirmBody": {
"cash": "The drawer opens. The amount comes off your shift's cash.",
"card": "Make the refund on the card terminal too. It counts against your shift's card total."
},
"keep": "Back",
"confirm": "Refund",
"done": {
"cash": "Refunded. Give back {{amount}} in cash",
"card": "Refunded {{amount}} to the card"
},
"fiscalManualBefore": "Afterwards, issue the credit note on the fiscal machine.",
"fiscalManualTitle": "Issue the credit note on the fiscal machine",
"fiscalManualBody": {
"cash": "The refund of {{amount}} (cash) is recorded. The system can't send credit notes to this fiscal machine yet: issue it on the machine now.",
"card": "The refund of {{amount}} (card) is recorded. The system can't send credit notes to this fiscal machine yet: issue it on the machine now."
},
"fiscalManualOk": "Done"
}
}
}