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.
asset_work.json · 5.6 KB · 59 lines
| 1 | { |
| 2 | "name": "asset_work", |
| 3 | "title": "Improvements And Repairs", |
| 4 | "version": 1, |
| 5 | "description": "Money spent on a fixed asset after it went into service, and the decision about what it was. An IMPROVEMENT adds to the asset's cost basis on its own date and depreciates from that month (its own life_months, blank: the asset's remaining book life); a REPAIR is an ordinary expense in the period. The decision is recorded on the row -- treatment, the rule of thumb it rests on (basis: betterment, restoration or adaptation for an improvement; routine maintenance or the de minimis safe harbor for a repair) and a short reason in the person's own words -- because the number in the books is only as good as the decision behind it, and the decision is what an accountant or an examiner asks about. The rule of thumb is written up in docs/assets-and-losses.md as text, not enforced numbers; it is not tax advice. The books pass composes DR asset cost / CR paid-from for an improvement and DR repair expense / CR paid-from for a repair (marker asset_work/{id}), then stamps status posted; a posted row is frozen. booking=booked_elsewhere records the decision without composing (the bill was already booked to the right account).", |
| 6 | "fields": [ |
| 7 | {"name": "id"}, |
| 8 | {"name": "asset_id", "type": "relation", "required": true, "label": "Asset", |
| 9 | "relation": {"collection": "fixed_assets", "display_field": "name", "requires": "update"}, |
| 10 | "help": "An improvement changes the asset's cost basis and its depreciation, so the writer must be allowed to update the asset."}, |
| 11 | {"name": "performed_on", "type": "date", "required": true, "label": "Performed On"}, |
| 12 | {"name": "description", "type": "text", "required": true, "label": "What Was Done", "validation": {"min_length": 1, "max_length": 300}}, |
| 13 | {"name": "amount_cents", "type": "integer", "required": true, "label": "Amount (cents)", "validation": {"min": 1}}, |
| 14 | {"name": "treatment", "type": "enum", "required": true, "label": "Treatment", "enum": ["improvement", "repair"], |
| 15 | "help": "improvement: capitalized and depreciated. repair: expensed now."}, |
| 16 | {"name": "basis", "type": "enum", "required": true, "label": "Rule Of Thumb", |
| 17 | "enum": ["betterment", "restoration", "adaptation", "routine_maintenance", "de_minimis", "other"], |
| 18 | "help": "Betterment (makes it better than it was), restoration (rebuilds a major part, or returns it to like-new after the end of its life), adaptation (puts it to a new use) point to an improvement. Routine maintenance (keeps it in its ordinary operating condition) and the de minimis safe harbor (an election with a per-item ceiling your accountant sets) point to a repair. other: say why in the reason. Not tax advice."}, |
| 19 | {"name": "reason", "type": "text", "required": true, "label": "Reason", "validation": {"min_length": 3, "max_length": 300}, |
| 20 | "help": "One sentence a stranger would understand: 'Rebuilt engine extends the van's life by three years.'"}, |
| 21 | {"name": "life_months", "type": "integer", "label": "Life (months)", "validation": {"min": 1, "max": 1200}, |
| 22 | "help": "Improvements only. Blank: the asset's remaining book life (at least one month)."}, |
| 23 | {"name": "booking", "type": "enum", "label": "Booking", "default": "post", "enum": ["post", "booked_elsewhere"]}, |
| 24 | {"name": "paid_from_account_id", "label": "Paid From Account", |
| 25 | "relation": {"collection": "fin_accounts", "display_field": "name", "requires": "update"}, |
| 26 | "help": "Blank: assets.journal.funding_account."}, |
| 27 | {"name": "expense_account_id", "label": "Repair Expense Account", |
| 28 | "relation": {"collection": "fin_accounts", "display_field": "name", "requires": "update"}, |
| 29 | "help": "Repairs only. Blank: assets.journal.repair_account."}, |
| 30 | {"name": "evidence_refs", "type": "textarea", "label": "Evidence", |
| 31 | "help": "The invoice, the work order, photos: references or attached files."}, |
| 32 | {"name": "status", "type": "enum", "label": "Booked", "enum": ["posted"], "read_only": true, |
| 33 | "help": "Blank until the books pass posts it; then the row is frozen."}, |
| 34 | {"name": "journal_id", "type": "text", "label": "Journal", "read_only": true}, |
| 35 | {"name": "posted_at", "type": "datetime", "label": "Posted", "read_only": true}, |
| 36 | {"name": "notes", "type": "textarea", "label": "Notes"}, |
| 37 | {"name": "owner_id", "type": "text", "label": "Owner"}, |
| 38 | {"name": "entity_id", "type": "text", "label": "Entity", |
| 39 | "relation": {"collection": "entities", "display_field": "name", "requires": "update"}}, |
| 40 | {"name": "created_at", "type": "datetime", "label": "Created", "read_only": true} |
| 41 | ], |
| 42 | "locked_when": [ |
| 43 | {"when": {"status": ["posted"]}, "except": ["notes", "evidence_refs"], |
| 44 | "message": "This work is on the books. Correct it with a reversing journal and a new entry, not an edit."} |
| 45 | ], |
| 46 | "locked_checks": [ |
| 47 | {"name": "work_fits_asset", "object": "check_assets", "function": "WORK_CHECK", |
| 48 | "reads": ["fixed_assets", "asset_disposals"], "lock": "assets", |
| 49 | "on": {"create": true, "update": ["asset_id", "performed_on", "treatment", "basis"], "delete": false}} |
| 50 | ], |
| 51 | "capabilities": {"comments": true, "attachments": true}, |
| 52 | "forms": {"default": {"fields": ["asset_id", "performed_on", "description", "amount_cents", "treatment", "basis", |
| 53 | "reason", "life_months", "booking", "paid_from_account_id", |
| 54 | "expense_account_id", "evidence_refs", "notes"]}}, |
| 55 | "views": {"list_mode": "table", |
| 56 | "list_fields": ["performed_on", "asset_id", "description", "treatment", "basis", "amount_cents", "status"], |
| 57 | "filter_fields": ["treatment", "basis"]}, |
| 58 | "search": {"fields": ["description", "reason", "evidence_refs"]} |
| 59 | } |