Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 31 minutes ago History
dbbasic-package.json · 8.9 KB · 92 lines
1{
2 "id": "app-counter",
3 "name": "Counter",
4 "version": "0.9.1",
5 "description": "Counter service after the sale: voids, corrections, goodwill, remakes and waste, for a cafe or any shop that hands things over the counter. Built from what a Haiku simulation of a counter cafe (Corner Cup) found: paid lines edited in place on the order and the invoice separately, voids that left the invoice billing the item, refunds with no line and no reason code, and staff who all used the owner's login. The doctrine it applies: an issued or paid document is not edited in place, corrections are new records citing the line they correct (docs/logic-decisions.md #3), and a void is the one change an unpaid line takes, on both documents at once. 0.1.0: correction_reasons (the reason codes, as data a manager extends) and action_counter_void (a cashier takes an item off an unpaid sale with a reason; the order line and the invoice line billing it go to zero together and both documents' totals are restated by exactly that line). 0.2.0: corrections after payment cite the item. action_counter_correct records a line refund (refunds v6: order_line_id, quantity, reason_code, approved_by) or a credit note (an invoices row of doc_type credit_note naming the invoice it credits, its line citing the order line), priced as the line was; a cashier corrects up to counter.refund_approval_threshold_cents (unset is 0) and above it, or for a needs_manager reason, cites a counter_approvals row a shift lead, manager or owner gave, spent once. The ledger locked checks refuse more than was sold, refunds and credit notes together. action_counter_pay lets a cashier record a payment at the counter without the invoice update power a payments grant would need. 0.3.0: counter and pickup sales move stock when they are handed over. action_counter_hand_over runs system_counter_stock's MOVE (one sale move per line, from shop.stock_location, marked orders/{order}:line/{line}, for whatever has not already left by a shipment, an earlier hand-over or a remake's waste) and only then marks the order collected; system_counter_stock also HANDLES orders updated to collected. object_reservations reads the marker, so an online order's hold becomes the move, and app-shipping's order fulfillment subtracts it, so nothing leaves the shelf twice. Corner Cup's counter sales never moved stock without auto_fulfill, a stock location and a shipment. 0.4.0: goodwill and remakes. goodwill is its own record, separate from refunds: value, reason code, the approver (the row's owner; only shift leads, managers and the owner create it) and the words the customer was given, with charge_was_correct true by default, so 'charged correctly, given something anyway' is said without pretending the charge was wrong; money paid out for it is a refund citing goodwill_id, capped by its value. action_counter_remake writes a zero-priced kitchen ticket line (order_lines.remake_of_line_id), a waste stock move counted against the original line's unmoved unit or else the remake's own, and a remakes record linking the three. 0.5.0: a waste log. action_counter_waste records waste by count (a waste stock move from shop.stock_location, the estimate quantity x its cost) or by weight per bin or category (no stock move; an estimated cost from counter.waste_cost_per_kg_cents[.category], stamped, or blank with a warning when none is set), with a reason code, who recorded it, where it went (trash, compost, animal feed, donation, rendering, digester), the recipient contact, and needs_licence with the licence number and expiry -- recorded and warned about, never judged legal or not. It says when the books will not receive the waste (accounts unset or missing from the chart). 0.6.0: history a manager can read, with the reason. A write can say why (the X-DBBASIC-Change-Reason header; every counter action sets its own, e.g. 'void (customer_error): changed mind'), and the change log records it as the entry's message. action_counter_history shows shift leads, managers and the owner the change history of the shop's sale and correction collections, only for records they may read, without the admin token. action_counter_customer_history folds complaints per customer per month: disputes, line refunds, goodwill and remakes, with the money given back. 0.7.0: a debt is cancelled only by a credit note. action_counter_correct settle=refund is a credit note plus a refund citing it, so the invoice reads paid for what was kept or refunded when all of it came back; action_counter_void on an issued invoice credits the line with a credit note applied at once instead of lowering the invoice's total, and voids only the order line. 0.8.0: a void of a checkout sale whose tax was computed over the whole bill now takes off exactly the tax stamped on the line that billed the item (decision 2) instead of refusing; a whole-line credit gives back the line's stamped amounts. A basket discount still refuses the void: how much of it an item carried is not decided. 0.9.0: the action is the grant, so each action checks its own scope. The counter actions write payments, credit notes, refunds and stock moves pointing at records the caller may only read, deliberately exempt from the relation check; a review showed they leaned on the server's execute rule, which is asked only with enforcement on, so with it off any signed-in user voided, paid and wasted. Every counter action now refuses (403) a caller who holds none of the roles its own execute rules name, and is not an admin (object_corrections.staff_refusal), whatever the enforcement setting. action_counter_pay takes payment only for an issued bill (not a draft, a void, a quote or a credit note, however it is named) with money open, and not more than is open; anything else gets the answer a missing id gets, before anything is written. It had skipped the issued filter when handed an invoice_id. counter_approvals v2: an approval names the item it approves (order_line_id, required_when on every kind); a blanket one is refused at creation, and one already on file is not honoured by a refund, credit note or remake. action_counter_waste by count reads the product under the action's own authority, only after the staff check (0.8.0 answered any signed-in caller, and its 404 named the id, confirming which products exist); a deny rule naming the caller for the product still wins, and a missing or denied product gets one answer that echoes no id. No read grant on products is added, and a cashier writes off up to counter.waste_approval_quantity in one entry alone; above it a counter_approvals row of kind waste (product_id, max_quantity; v3) is cited and spent, and waste_logs.approval_id records it. Unset, the limit is 3, the smallest that keeps the ordinary counter waste working; a value that is not a positive number means approval always. Operators who record bigger waste entries by count set counter.waste_approval_quantity. 0.9.1: action_counter_history cuts each entry down to the fields the caller may read (before and after snapshots, and the changed-field list), as the records API would; it showed the whole snapshot of any row the caller could open.",
6 "compatibility": {
7 "dbbasic_object_server": ">=0.1.0"
8 },
9 "dependencies": [
10 "app-orders",
11 "app-invoices",
12 "app-payments",
13 "app-settings",
14 "app-catalog"
15 ],
16 "objects": [
17 {
18 "id": "action_counter_void",
19 "path": "objects/action/counter_void.py"
20 },
21 {
22 "id": "action_counter_correct",
23 "path": "objects/action/counter_correct.py"
24 },
25 {
26 "id": "action_counter_pay",
27 "path": "objects/action/counter_pay.py"
28 },
29 {
30 "id": "system_counter_stock",
31 "path": "objects/system/counter_stock.py"
32 },
33 {
34 "id": "action_counter_hand_over",
35 "path": "objects/action/counter_hand_over.py"
36 },
37 {
38 "id": "hook_goodwill",
39 "path": "objects/hook/goodwill.py"
40 },
41 {
42 "id": "action_counter_remake",
43 "path": "objects/action/counter_remake.py"
44 },
45 {
46 "id": "action_counter_waste",
47 "path": "objects/action/counter_waste.py"
48 },
49 {
50 "id": "action_counter_history",
51 "path": "objects/action/counter_history.py"
52 },
53 {
54 "id": "action_counter_customer_history",
55 "path": "objects/action/counter_customer_history.py"
56 }
57 ],
58 "schemas": [
59 {
60 "collection": "correction_reasons",
61 "path": "schemas/correction_reasons.json"
62 },
63 {
64 "collection": "counter_approvals",
65 "path": "schemas/counter_approvals.json"
66 },
67 {
68 "collection": "goodwill",
69 "path": "schemas/goodwill.json"
70 },
71 {
72 "collection": "remakes",
73 "path": "schemas/remakes.json"
74 },
75 {
76 "collection": "waste_logs",
77 "path": "schemas/waste_logs.json"
78 }
79 ],
80 "permissions": [
81 {
82 "path": "permissions/rules.json"
83 }
84 ],
85 "seed": [
86 {
87 "collection": "correction_reasons",
88 "path": "seed/correction_reasons.tsv"
89 }
90 ],
91 "migrations": []
92}