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
receipt_lines.json · 5.8 KB · 96 lines
| 1 | { |
| 2 | "name": "receipt_lines", |
| 3 | "title": "Receipt Lines", |
| 4 | "version": 1, |
| 5 | "hooks": {"before_write": "hook_receipt_lines"}, |
| 6 | "description": "Expected against received against rejected, per ordered thing. This is the collection the discrepancy IS: three columns rather than one, because 'we received 8' is not an answer to 'the supplier billed us for 10'. quantity_expected is what the purchase order line said, stamped here so the sheet still reads correctly after somebody amends the PO; quantity_received is what went onto the shelf and is what composes the `purchase` stock move; quantity_rejected is what physically arrived and is going straight back. The gate that makes the fold trustworthy lives in hook_receipt_lines: cumulative quantity_received across every receipt of one order line may never exceed the quantity ordered, refused with all three numbers rather than a shrug, exactly as hook_shipment_lines does on the sales side. description is STAMPED from the order line at creation so a receiving sheet printed next year still says what the dock actually counted, even if the product has since been renamed (docs/logic-decisions.md #1).", |
| 7 | "fields": [ |
| 8 | { |
| 9 | "name": "id" |
| 10 | }, |
| 11 | { |
| 12 | "name": "receipt_id", |
| 13 | "type": "relation", |
| 14 | "required": true, |
| 15 | "relation": { |
| 16 | "collection": "receipts", |
| 17 | "display_field": "id" |
| 18 | }, |
| 19 | "label": "Receipt", |
| 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 purchase order line these goods satisfy. Required, and not merely a cross-reference: without it the over-receiving gate has nothing to count against, and 'eight of something turned up' is not an answer to 'did the supplier send what we ordered?'. Plain text rather than a declared relation, so this package can be installed alongside an app-orders that is not there yet -- the same reasoning shipment_lines.order_line_id carries, and 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 purchase stock move is composed against; a line with no product moves no stock, which is correct for a service, a delivery charge, 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 purchase order line at creation. The receiving sheet prints THIS, not a live product lookup: the paperwork about a delivery must keep saying what was counted off the pallet." |
| 44 | }, |
| 45 | { |
| 46 | "name": "quantity_expected", |
| 47 | "type": "number", |
| 48 | "default": "0", |
| 49 | "label": "Expected", |
| 50 | "help": "What the purchase order line said was coming, stamped at creation. Kept alongside the received count rather than looked up live, because a PO amended after the fact would otherwise rewrite history and make an honest short delivery look like a clean one. A count/measure, not money -- may be fractional, the same deliberate exception order_lines.quantity documents; read with Decimal everywhere." |
| 51 | }, |
| 52 | { |
| 53 | "name": "quantity_received", |
| 54 | "type": "number", |
| 55 | "default": "0", |
| 56 | "label": "Received", |
| 57 | "help": "What went onto the shelf. This is the number the `purchase` stock move is composed for and the number the PO's derived status is folded from; the over-receiving gate counts cumulative values of THIS field across every receipt against one order line. Zero is allowed and sometimes correct (the pallet arrived empty of this item), but a zero line must carry a rejected quantity or a discrepancy note -- see hook_receipt_lines." |
| 58 | }, |
| 59 | { |
| 60 | "name": "quantity_rejected", |
| 61 | "type": "number", |
| 62 | "default": "0", |
| 63 | "label": "Rejected", |
| 64 | "help": "Goods that PHYSICALLY ARRIVED and are being sent back -- damaged, wrong size, past date. They are NOT a short delivery, and conflating the two is how a supplier gets paid for what they never delivered: a short delivery means the goods were never sent and must never be invoiced, while a rejection means they were sent, we hold the evidence, and the argument is about credit. Rejected quantities compose NO stock move, because they never entered stock (system_receipt_posting)." |
| 65 | }, |
| 66 | { |
| 67 | "name": "discrepancy_note", |
| 68 | "type": "textarea", |
| 69 | "label": "Discrepancy Note", |
| 70 | "help": "Why the three numbers disagree, in the receiver's own words: 'two cartons crushed', 'supplier substituted the 500ml'. Free text on purpose -- a reason-code enum invented before anyone has read a hundred real ones is a taxonomy that makes the dock pick the closest wrong answer. Required by hook_receipt_lines on any line that received nothing, because a blank zero is indistinguishable from a data-entry slip." |
| 71 | }, |
| 72 | { |
| 73 | "name": "owner_id", |
| 74 | "type": "text", |
| 75 | "label": "Owner" |
| 76 | }, |
| 77 | { |
| 78 | "name": "created_at", |
| 79 | "type": "datetime", |
| 80 | "label": "Created", |
| 81 | "read_only": true |
| 82 | } |
| 83 | ], |
| 84 | "forms": { |
| 85 | "default": { |
| 86 | "fields": ["receipt_id", "order_line_id", "product_id", "description", |
| 87 | "quantity_expected", "quantity_received", "quantity_rejected", |
| 88 | "discrepancy_note"] |
| 89 | } |
| 90 | }, |
| 91 | "views": { |
| 92 | "list_mode": "table", |
| 93 | "list_fields": ["description", "quantity_expected", "quantity_received", |
| 94 | "quantity_rejected", "receipt_id"] |
| 95 | } |
| 96 | } |