askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
correction_reasons.json · 2.9 KB · 36 lines
| 1 | { |
| 2 | "name": "correction_reasons", |
| 3 | "title": "Correction Reasons", |
| 4 | "version": 1, |
| 5 | "description": "Why a sale was corrected: the codes a void, a line refund, a credit note, goodwill, a remake or a waste entry must cite. DATA, not an enum, so a shop adds its own (a manager writes a row) without a schema change; the six it ships with are the ones a counter cafe's day produced (Corner Cup, a Haiku simulation): wrong_item_by_staff, customer_error, quality, partly_eaten, goodwill, remake. charge_was_correct is the line between a correction and a kindness: a refund for a wrong item says the charge was wrong; goodwill says it was right and something was given anyway, so the books and the complaint history can tell 'we made a mistake' from 'we were generous' without anybody having to pretend the sale was mispriced. applies_to says which acts may cite the code (void, refund, credit_note, goodwill, remake, waste; comma-separated). An inactive code stays readable on the records that cite it and cannot be cited again.", |
| 6 | "unique": [ |
| 7 | {"fields": ["code"], "message": "That reason code already exists."} |
| 8 | ], |
| 9 | "views": { |
| 10 | "list_mode": "table", |
| 11 | "list_fields": ["code", "label", "applies_to", "charge_was_correct", "active"] |
| 12 | }, |
| 13 | "forms": { |
| 14 | "default": {"fields": ["code", "label", "applies_to", "charge_was_correct", "needs_manager", "customer_wording", "active"]} |
| 15 | }, |
| 16 | "fields": [ |
| 17 | {"name": "id"}, |
| 18 | {"name": "code", "type": "text", "required": true, "label": "Code", |
| 19 | "validation": {"pattern": "^[a-z][a-z0-9_]{1,63}$"}, |
| 20 | "description": "What records cite: lower_snake_case."}, |
| 21 | {"name": "label", "type": "text", "required": true, "label": "Label", |
| 22 | "validation": {"min_length": 1, "max_length": 120}}, |
| 23 | {"name": "applies_to", "type": "text", "required": true, "label": "Applies to", |
| 24 | "validation": {"pattern": "^(void|refund|credit_note|goodwill|remake|waste)(,(void|refund|credit_note|goodwill|remake|waste))*$"}, |
| 25 | "description": "Comma-separated acts that may cite this code: void, refund, credit_note, goodwill, remake, waste."}, |
| 26 | {"name": "charge_was_correct", "type": "boolean", "default": "false", "label": "Charge was correct", |
| 27 | "description": "True when the customer was charged correctly and something is being given anyway (goodwill, a partly eaten dish taken back as a kindness). False when the charge itself was the mistake."}, |
| 28 | {"name": "needs_manager", "type": "boolean", "default": "false", "label": "Always needs a manager", |
| 29 | "description": "A correction citing this code needs a manager's approval whatever its amount (the store threshold counter.refund_approval_threshold_cents decides the rest)."}, |
| 30 | {"name": "customer_wording", "type": "text", "label": "What the customer is told", |
| 31 | "validation": {"max_length": 300}}, |
| 32 | {"name": "active", "type": "boolean", "default": "true", "label": "Active"}, |
| 33 | {"name": "owner_id", "type": "text"}, |
| 34 | {"name": "created_at", "type": "datetime", "read_only": true} |
| 35 | ] |
| 36 | } |