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
reorder_suggestions.json · 4.1 KB · 34 lines
| 1 | { |
| 2 | "name": "reorder_suggestions", |
| 3 | "title": "Reorder Suggestions", |
| 4 | "version": 1, |
| 5 | "description": "A SUGGESTION, and the noun is the whole design. system_reorder_check folds stock levels nightly, finds the products at or below their reorder_point, and writes a row here saying so -- it does not raise a purchase order, and it never will. A machine that orders on its own is how a business ends up with forty pallets of the wrong thing: the fold can see the shelf, and it cannot see the supplier's minimum, the lead time, the case size, the promotion that is about to triple demand, the discontinued line somebody has already decided to run down, or the cash in the bank this week. All of that lives in a human's head, and the honest division of labour is that the server NOTICES and the person DECIDES. So the row carries what was observed (on_hand, the point it crossed) and what the catalogue says to buy (suggested_quantity, straight off products.reorder_quantity, zero when nobody has said), and its status is the record of what the human did about it. One OPEN row per product at a time: a nightly pass that appended a new suggestion every night would produce a queue of ninety copies of one fact, which is a queue nobody reads. The pass refreshes the open row's observation instead, so the number in front of somebody is today's. dismissed is a first-class ending and needs no ceremony -- 'we know, we are running it down' is a real answer, and a suggestion that cannot be dismissed becomes a permanently lit band that teaches people to ignore the whole home screen.", |
| 6 | "fields": [ |
| 7 | {"name": "id"}, |
| 8 | {"name": "product_id", "required": true, "label": "Product", |
| 9 | "relation": {"collection": "products", "display_field": "name"}}, |
| 10 | {"name": "on_hand", "type": "number", "default": "0", "label": "On Hand", |
| 11 | "help": "What the stock ledger folded to when this was last observed. Recorded rather than computed at read time so the row says what was true when somebody was told, and so a page listing suggestions is a read of one collection rather than a stock fold per line."}, |
| 12 | {"name": "reorder_point", "type": "integer", "default": "0", |
| 13 | "label": "Reorder Point", |
| 14 | "help": "The threshold this crossed, stamped from the product at the moment of observation. Kept here so that raising the point tomorrow does not make yesterday's suggestion look like a mistake."}, |
| 15 | {"name": "suggested_quantity", "type": "integer", "default": "0", |
| 16 | "label": "Suggest Ordering", |
| 17 | "help": "products.reorder_quantity, copied. Zero means the catalogue has not said how many, and the suggestion is simply that the shelf is low -- which is honest, because how much to buy depends on lead time, case size and what the supplier will sell, and a guessed number is a guess about somebody's money."}, |
| 18 | {"name": "status", "type": "enum", "default": "open", "label": "Status", |
| 19 | "enum": ["open", "ordered", "dismissed"], |
| 20 | "help": "open is waiting on a human. ordered is somebody bought some -- set by hand, because this server does not raise purchase orders and pretending it observed one would be a lie. dismissed is 'we know', which is a real answer and needs to be available, or the count stays lit forever and teaches people to stop reading the band it sits in."}, |
| 21 | {"name": "suggested_on", "type": "date", "label": "Suggested", |
| 22 | "help": "The day the fold last observed this. Refreshed on the open row rather than appended, so the number in front of somebody is today's and the queue is not ninety copies of one fact."}, |
| 23 | {"name": "notes", "type": "textarea", "label": "Notes"}, |
| 24 | {"name": "owner_id", "type": "text", "label": "Owner"}, |
| 25 | {"name": "created_at", "type": "datetime", "read_only": true, "label": "Recorded"} |
| 26 | ], |
| 27 | "forms": {"default": {"fields": ["product_id", "on_hand", "reorder_point", |
| 28 | "suggested_quantity", "status", |
| 29 | "suggested_on", "notes"]}}, |
| 30 | "views": {"list_mode": "table", |
| 31 | "list_fields": ["suggested_on", "product_id", "on_hand", |
| 32 | "reorder_point", "suggested_quantity", "status"], |
| 33 | "filter_fields": ["status"]} |
| 34 | } |