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.
supplier_payment_lines.json · 1.7 KB · 26 lines
| 1 | { |
| 2 | "name": "supplier_payment_lines", |
| 3 | "title": "Supplier Payment Lines", |
| 4 | "version": 1, |
| 5 | "description": "How much of one supplier payment went to one bill. Any amount above zero: 60% of a bill is a line of 60% of it, and one payment that settles three bills is three lines. A bill's paid_cents is the sum of its lines (a rollup on supplier_bills), so what a bill still owes is derived and can never drift from the payments that make it up. A line needs update on its payment (relation requires), which the payment's owner has only until the supplier is told; once the payment is remitted the exchange stamps the line remitted too and locked_when freezes it.", |
| 6 | "fields": [ |
| 7 | {"name": "id"}, |
| 8 | {"name": "payment_id", "type": "relation", "required": true, "label": "Payment", |
| 9 | "relation": {"collection": "supplier_payments", "display_field": "payment_reference", |
| 10 | "requires": "update"}}, |
| 11 | {"name": "bill_id", "type": "relation", "required": true, "label": "Bill", |
| 12 | "relation": {"collection": "supplier_bills", "display_field": "number", "requires": "update"}}, |
| 13 | {"name": "amount_cents", "type": "integer", "required": true, "label": "Amount Paid", |
| 14 | "validation": {"min": 1}}, |
| 15 | {"name": "remitted", "type": "boolean", "default": "false", |
| 16 | "permissions": {"edit": ["role:admin"], "default": "read"}, |
| 17 | "label": "Supplier Told"}, |
| 18 | {"name": "owner_id", "type": "text"}, |
| 19 | {"name": "created_at", "type": "datetime", "read_only": true, "label": "Created"} |
| 20 | ], |
| 21 | "locked_when": [ |
| 22 | {"when": {"remitted": "true"}, "except": [], |
| 23 | "message": "The supplier has been told this was paid on this bill."} |
| 24 | ], |
| 25 | "views": {"list_mode": "table", "list_fields": ["bill_id", "amount_cents", "remitted"]} |
| 26 | } |