Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 42 minutes ago History
receipt_lines.json · 6.1 KB · 102 lines
1{
2 "name": "receipt_lines",
3 "title": "Receipt Lines",
4 "version": 3,
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). v3: relation.requires update on the receipt, the purchase order line received against and the product whose stock it is.",
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 "requires": "update"},
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 "relation": {
27 "collection": "order_lines",
28 "display_field": "description",
29 "requires": "update"},
30 "label": "Order Line",
31 "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."
32 },
33 {
34 "name": "product_id",
35 "label": "Product",
36 "relation": {
37 "collection": "products",
38 "display_field": "name",
39 "requires": "update"},
40 "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."
41 },
42 {
43 "name": "description",
44 "type": "text",
45 "label": "Description",
46 "validation": {"max_length": 300},
47 "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."
48 },
49 {
50 "name": "quantity_expected",
51 "type": "number",
52 "default": "0",
53 "label": "Expected",
54 "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."
55 },
56 {
57 "name": "quantity_received",
58 "type": "number",
59 "default": "0",
60 "validation": {"min": 0},
61 "label": "Received",
62 "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."
63 },
64 {
65 "name": "quantity_rejected",
66 "type": "number",
67 "default": "0",
68 "validation": {"min": 0},
69 "label": "Rejected",
70 "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)."
71 },
72 {
73 "name": "discrepancy_note",
74 "type": "textarea",
75 "label": "Discrepancy Note",
76 "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."
77 },
78 {
79 "name": "owner_id",
80 "type": "text",
81 "label": "Owner"
82 },
83 {
84 "name": "created_at",
85 "type": "datetime",
86 "label": "Created",
87 "read_only": true
88 }
89 ],
90 "forms": {
91 "default": {
92 "fields": ["receipt_id", "order_line_id", "product_id", "description",
93 "quantity_expected", "quantity_received", "quantity_rejected",
94 "discrepancy_note"]
95 }
96 },
97 "views": {
98 "list_mode": "table",
99 "list_fields": ["description", "quantity_expected", "quantity_received",
100 "quantity_rejected", "receipt_id"]
101 }
102}