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, 42 minutes ago History
counter_approvals.json · 3.4 KB · 38 lines
1{
2 "name": "counter_approvals",
3 "title": "Counter Approvals",
4 "version": 3,
5 "description": "A manager's yes to a correction a cashier may not make alone: a refund or credit note above the store threshold (counter.refund_approval_threshold_cents), one citing a reason code marked needs_manager, goodwill, a remake, or waste of more than counter.waste_approval_quantity in one entry. The approver is the row's owner -- the server stamps owner_id with whoever created it and refuses a create that names somebody else -- and only shift leads, managers and the owner may create one, so the row existing is the approval. It is single use: the action that spends it stamps used_at and used_for with a compare-and-set, so one yes cannot pay out twice. Nobody edits or deletes an approval afterwards (the owner fallback is off); a mistaken one is simply never used. An approval names the item it approves (order_line_id; for waste, product_id and max_quantity); one with no item is refused when it is created, and one already on file is never honoured (version 2: a blank, any-item approval with a huge limit was accepted). Corner Cup (a Haiku simulation of a counter cafe) found refunds and post-payment edits with no approval at all.",
6 "views": {
7 "list_mode": "table",
8 "list_fields": ["created_at", "kind", "max_amount_cents", "reason_code", "owner_id", "used_at"]
9 },
10 "forms": {
11 "default": {"fields": ["kind", "order_line_id", "product_id", "max_quantity", "max_amount_cents", "reason_code", "note"]}
12 },
13 "fields": [
14 {"name": "id"},
15 {"name": "kind", "type": "enum", "required": true, "default": "correction", "label": "Approves",
16 "enum": ["correction", "refund", "credit_note", "goodwill", "remake", "waste"],
17 "description": "What it approves; correction covers a refund or a credit note. waste approves writing off more of one product than a cashier may alone (counter.waste_approval_quantity)."},
18 {"name": "order_line_id", "type": "text", "label": "Order line",
19 "validation": {"max_length": 64,
20 "required_when": {"kind": ["correction", "refund", "credit_note", "goodwill", "remake"]}},
21 "description": "The item it approves a correction of. Required: there is no blanket approval, and the action that spends one refuses an approval naming no item."},
22 {"name": "product_id", "type": "text", "label": "Product",
23 "validation": {"max_length": 64, "required_when": {"kind": ["waste"]}},
24 "description": "For a waste approval: the product it approves writing off."},
25 {"name": "max_quantity", "type": "number", "label": "Up to (how many)",
26 "validation": {"exclusive_min": 0, "required_when": {"kind": ["waste"]}},
27 "description": "For a waste approval: the most it approves writing off, in one entry."},
28 {"name": "max_amount_cents", "type": "integer", "required": true, "default": "0", "label": "Up to (cents)",
29 "validation": {"min": 0}},
30 {"name": "reason_code", "type": "text", "label": "Reason code", "validation": {"max_length": 64}},
31 {"name": "note", "type": "text", "label": "Note", "validation": {"max_length": 300}},
32 {"name": "used_at", "type": "datetime", "read_only": true, "label": "Used at"},
33 {"name": "used_for", "type": "text", "read_only": true, "label": "Used for",
34 "validation": {"max_length": 200}},
35 {"name": "owner_id", "type": "text", "label": "Approved by"},
36 {"name": "created_at", "type": "datetime", "read_only": true}
37 ]
38}