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
shipment_lines.json · 3.3 KB · 73 lines
| 1 | { |
| 2 | "name": "shipment_lines", |
| 3 | "title": "Shipment Lines", |
| 4 | "version": 1, |
| 5 | "hooks": {"before_write": "hook_shipment_lines"}, |
| 6 | "description": "What was actually in the box. This is the collection partial fulfillment is derived FROM: cumulative shipped quantity per order line is a fold over these rows, and orders.status (partial/shipped/delivered) is a read of that fold, never a hand-maintained flag. The gate that makes the fold trustworthy lives in hook_shipment_lines: cumulative quantity across every shipment of one order line may never exceed the quantity ordered, refused with all three numbers rather than a shrug. description is STAMPED from the order line at creation so a packing slip printed next year still says what the packer put in the box, even if the product has since been renamed (docs/logic-decisions.md #1).", |
| 7 | "fields": [ |
| 8 | { |
| 9 | "name": "id" |
| 10 | }, |
| 11 | { |
| 12 | "name": "shipment_id", |
| 13 | "type": "relation", |
| 14 | "required": true, |
| 15 | "relation": { |
| 16 | "collection": "shipments", |
| 17 | "display_field": "id" |
| 18 | }, |
| 19 | "label": "Shipment", |
| 20 | "help": "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." |
| 21 | }, |
| 22 | { |
| 23 | "name": "order_line_id", |
| 24 | "type": "text", |
| 25 | "required": true, |
| 26 | "label": "Order Line", |
| 27 | "help": "Which order line this quantity satisfies. Required, and not merely a cross-reference: without it the over-shipping gate has nothing to count against, and 'we shipped three of something' is not an answer to 'did the customer get what they ordered?'. Plain text rather than a declared relation, so this package can be installed alongside an app-orders that is not there yet -- the hook does the real check and says so in words." |
| 28 | }, |
| 29 | { |
| 30 | "name": "product_id", |
| 31 | "label": "Product", |
| 32 | "relation": { |
| 33 | "collection": "products", |
| 34 | "display_field": "name" |
| 35 | }, |
| 36 | "help": "Optional cross-reference to app-catalog's products, mirroring order_lines.product_id. It is what the sale stock move is composed against; a line with no product moves no stock, which is correct for a service or a free-text line that never sat on a shelf." |
| 37 | }, |
| 38 | { |
| 39 | "name": "description", |
| 40 | "type": "text", |
| 41 | "label": "Description", |
| 42 | "validation": {"max_length": 300}, |
| 43 | "help": "Stamped from the order line at creation. The packing slip prints THIS, not a live product lookup: a parcel's paperwork must keep saying what was in it." |
| 44 | }, |
| 45 | { |
| 46 | "name": "quantity", |
| 47 | "type": "number", |
| 48 | "default": "1", |
| 49 | "label": "Quantity", |
| 50 | "help": "A count/measure, not money -- may be fractional, same deliberate exception order_lines.quantity documents. Read with Decimal everywhere (hook_shipment_lines, action_create_shipment, system_order_fulfillment), never a bare float." |
| 51 | }, |
| 52 | { |
| 53 | "name": "owner_id", |
| 54 | "type": "text", |
| 55 | "label": "Owner" |
| 56 | }, |
| 57 | { |
| 58 | "name": "created_at", |
| 59 | "type": "datetime", |
| 60 | "label": "Created", |
| 61 | "read_only": true |
| 62 | } |
| 63 | ], |
| 64 | "forms": { |
| 65 | "default": { |
| 66 | "fields": ["shipment_id", "order_line_id", "product_id", "description", "quantity"] |
| 67 | } |
| 68 | }, |
| 69 | "views": { |
| 70 | "list_mode": "table", |
| 71 | "list_fields": ["description", "quantity", "shipment_id"] |
| 72 | } |
| 73 | } |