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.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
receipts.json · 5.1 KB · 89 lines
| 1 | { |
| 2 | "name": "receipts", |
| 3 | "title": "Receipts", |
| 4 | "version": 1, |
| 5 | "description": "What actually turned up on the dock. A receipt is the counterpart of a shipment, pointed the other way: a purchase order says what was ORDERED from a supplier, a receipt says what arrived, and the difference between the two is the discrepancy -- the short delivery, the broken carton, the substituted size -- that has to stay VISIBLE rather than being silently reconciled away by whoever is holding the clipboard. Every system that folds the two facts into one 'received' tick on the PO loses the only evidence a shop has when it argues with a supplier about an invoice, and it loses it at exactly the moment the goods stop being countable. The quantities on receipt_lines are the facts; the purchase order's status is a READ of them (partial when some of what was ordered has arrived, received when all of it has), derived by system_receipt_posting and never hand-typed, the same doctrine app-shipping's shipment lines established for the sales side (docs/logic-decisions.md #1). Each received quantity composes one `purchase` stock move, idempotent by a per-line provenance marker, so a replayed event never puts the same carton on the shelf twice. supplier_reference is THEIR number -- the packing slip or delivery note in the driver's hand -- kept because reconciling a supplier invoice three weeks later is done against that number and nothing else we hold.", |
| 6 | "fields": [ |
| 7 | { |
| 8 | "name": "id" |
| 9 | }, |
| 10 | { |
| 11 | "name": "order_id", |
| 12 | "type": "relation", |
| 13 | "required": true, |
| 14 | "relation": { |
| 15 | "collection": "orders", |
| 16 | "display_field": "number" |
| 17 | }, |
| 18 | "label": "Purchase Order", |
| 19 | "help": "The PURCHASE order (orders.doc_type = purchase) these goods arrived against, and the provenance link the derived PO status walks back along. A sales order here would be nonsense in the direction goods travel, which is why action_receive_goods refuses one in words. Set once at creation and not intended to change after -- not schema read_only for the same reason order_lines.order_id is not: a required, client-submitted-at-creation field cannot also be read_only on this platform." |
| 20 | }, |
| 21 | { |
| 22 | "name": "status", |
| 23 | "type": "enum", |
| 24 | "label": "Status", |
| 25 | "default": "open", |
| 26 | "enum": ["open", "received", "cancelled"], |
| 27 | "transitions": { |
| 28 | "open": [ |
| 29 | {"to": "received", "when": {"owner_id": "$user_id"}}, |
| 30 | {"to": "cancelled", "when": {"owner_id": "$user_id"}} |
| 31 | ] |
| 32 | }, |
| 33 | "help": "open is the check-in in progress -- the pallet is on the floor and somebody is counting. received is TERMINAL: goods that arrived cannot un-arrive, and a mistake in the count is corrected by an adjustment move or a return, never by editing the row that says what the driver handed over (docs/logic-decisions.md #3). cancelled is the receipt that was raised and then abandoned before anything was counted -- its lines consume no ordered quantity, which is why the over-receiving gate skips them. Stock moves are composed when this reaches received, one `purchase` move per line, idempotent by provenance marker." |
| 34 | }, |
| 35 | { |
| 36 | "name": "received_on", |
| 37 | "type": "date", |
| 38 | "label": "Received", |
| 39 | "help": "The day the goods physically arrived, which is not always the day somebody got round to typing them in. It is the date stamped on the stock moves, because a level folded as of month-end has to agree with what was on the shelf at month-end (schemas/stock_moves.json's tax posture note)." |
| 40 | }, |
| 41 | { |
| 42 | "name": "supplier_reference", |
| 43 | "type": "text", |
| 44 | "label": "Supplier Reference", |
| 45 | "validation": {"max_length": 120}, |
| 46 | "help": "Their packing slip or delivery note number, as written on the paper in the driver's hand. Free text and theirs, not ours: when the supplier's invoice arrives three weeks later it cites this number and nothing else we hold, and a receipt that did not record it turns that reconciliation into a guessing game across dates." |
| 47 | }, |
| 48 | { |
| 49 | "name": "notes", |
| 50 | "type": "textarea", |
| 51 | "label": "Notes", |
| 52 | "help": "Also where the provenance marker lands ('Generated by action_receive_goods [orders/{id}]'), the same house pattern app-shipping's create_shipment uses for the shipments it raises." |
| 53 | }, |
| 54 | { |
| 55 | "name": "owner_id", |
| 56 | "type": "text", |
| 57 | "label": "Owner" |
| 58 | }, |
| 59 | { |
| 60 | "name": "entity_id", |
| 61 | "type": "text", |
| 62 | "label": "Entity", |
| 63 | "relation": { |
| 64 | "collection": "entities", |
| 65 | "display_field": "name" |
| 66 | }, |
| 67 | "help": "The set of books this belongs to (65 multi-entity). Optional during rollout, same posture as stock_moves.entity_id and shipments.entity_id." |
| 68 | }, |
| 69 | { |
| 70 | "name": "created_at", |
| 71 | "type": "datetime", |
| 72 | "label": "Created", |
| 73 | "read_only": true |
| 74 | } |
| 75 | ], |
| 76 | "forms": { |
| 77 | "default": { |
| 78 | "fields": ["order_id", "status", "received_on", "supplier_reference", "notes"] |
| 79 | } |
| 80 | }, |
| 81 | "views": { |
| 82 | "list_mode": "table", |
| 83 | "list_fields": ["order_id", "status", "received_on", "supplier_reference"], |
| 84 | "filter_fields": ["status"] |
| 85 | }, |
| 86 | "search": { |
| 87 | "fields": ["supplier_reference"] |
| 88 | } |
| 89 | } |