Skip to content

model.rk ​

Rangka model

Lives in modules/<module>/models/<model>.rk · Schema model.json (source) · first line: # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json

Properties ​

PropertyTypeMeaning
name requirednamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
labellabelA label in Bahasa Indonesia (required) and optionally English.
label.id requiredstring
label.enstring
iconstring
is_submittableboolean
is_childboolean
append_onlybooleanA ledger: rows are written only by flows, hooks and seed; nobody, the owner included, creates them through the API, updates or deletes them. A correction is a reversing row (contract 0026).
default false
namingstring or objecte.g. INV-{YYYY}-{#####} or STRK-{outlet.code}-{YY}{MM}-{####} (a field token, one counter per rendered prefix), or {series: invoice, pattern: 'INV/{ORG}/{YY}/{####}'} (contract 0009)
naming_ondevicedevice: the name comes with the write from a paired device and the kernel checks it against the string naming, which carries {device.code}, instead of making it; a write without a device keeps the kernel's numbering with {device.code} left out (contract 0058 §3)
title_fieldnamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
fields requiredlist of object
at least 1
ruleslist of object
rules[].name requirednamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
rules[].on requiredsave · submit · cancel
rules[].levelerror · warn · info
rules[].check requiredCELA CEL expression (plus Rangka helpers)
rules[].message requiredlabelA label in Bahasa Indonesia (required) and optionally English.
rules[].message.id requiredstring
rules[].message.enstring
approvalslist of object
approvals[].name requirednamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
approvals[].on requirednamesubmit, cancel or an action name of this model
pattern ^[a-z][a-z0-9_]{0,62}$
approvals[].whenCELPolicy applies only when this is true (absent = always)
approvals[].approvers requiredlist of nameRoles that may approve; owner always may
at least 1
approvals[].labellabelA label in Bahasa Indonesia (required) and optionally English.
approvals[].label.id requiredstring
approvals[].label.enstring
on_submitlist of string
on_cancellist of string
stockobjectHow stock.post_moves moves stock for this model (contract 0021). The six built-in stock documents keep their own rule and may not declare one.
stock.datenameHeader date field used as posting_date (default: the first required date field)
pattern ^[a-z][a-z0-9_]{0,62}$
stock.moves requiredlist of object
at least 1
stock.moves[].lines requirednameTable field whose rows move
pattern ^[a-z][a-z0-9_]{0,62}$
stock.moves[].instringOutlet the rows come into: a header link field, or line.<field>
pattern ^(line\.)?[a-z][a-z0-9_]{0,62}$
stock.moves[].outstringOutlet the rows leave: a header link field, or line.<field>
pattern ^(line\.)?[a-z][a-z0-9_]{0,62}$
stock.moves[].itemnameLine link to item (default item)
pattern ^[a-z][a-z0-9_]{0,62}$
stock.moves[].qtynameLine quantity in stock uom (default stock_qty when the line has it, else qty)
pattern ^[a-z][a-z0-9_]{0,62}$
stock.moves[].ifCELPer line, with doc and line; false skips the line
stock.moves[].reason requirednameAn option of stock_move.reason
pattern ^[a-z][a-z0-9_]{0,62}$
stock.moves[].exploderecipeout: consume through the item's active recipe; in: bring its materials back (cost average or source)
stock.moves[].costaverage or object or object or object or objectin only: average (default), {unit: f}, {amount: f}, {source: link},
stock.moves[].cogsnameout only: read-only currency line field that gets the value the line took out
pattern ^[a-z][a-z0-9_]{0,62}$
stock.cogs_totalnameRead-only currency header field that gets the value taken out by all cogs lines
pattern ^[a-z][a-z0-9_]{0,62}$
stock.negativeallow · refuserefuse: submit fails when an out move would leave the outlet below zero (default allow)
actionslist of object
actions[].name requirednamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
actions[].descriptionobjectOwner sentence of what this does, conditions included (contract 0060 §1). Changes no behaviour.
actions[].description.id requiredstring
actions[].description.enstring
actions[].label requiredlabelA label in Bahasa Indonesia (required) and optionally English.
actions[].label.id requiredstring
actions[].label.enstring
actions[].iconstring
actions[].hook requiredstring
pattern ^[a-z_]+\.[a-z_]+$
actions[].primaryboolean
actions[].ifCELA CEL expression (plus Rangka helpers)
actions[].queueobjectRun in the background (needs system.queue).
actions[].queue.retriesinteger
min 0, max 25
actions[].queue.backoffstring
pattern ^[0-9]+(s|m|h)$
actions[].queue.timeoutstring
pattern ^[0-9]+(s|m|h)$
automationslist of object
automations[].name requirednamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
automations[].descriptionobjectOwner sentence of what this does, conditions included (contract 0060 §1). Changes no behaviour.
automations[].description.id requiredstring
automations[].description.enstring
automations[].when requiredstring
automations[].ifCELA CEL expression (plus Rangka helpers)
automations[].do requiredstring
permissionslist of object
permissions[].role requirednamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
permissions[].ifCELA CEL expression (plus Rangka helpers)
permissions[].readboolean
permissions[].createboolean
permissions[].writeboolean
permissions[].deleteboolean
permissions[].submitboolean
permissions[].cancelboolean
permissions[].amendboolean
permissions[].exportboolean
permissions[].importboolean
permissions[].printboolean
permissions[].customizeboolean
viewsobject
views.defaultlist · kanban · calendar · report
views.listobject
views.list.columnslist of string
at least 1
views.list.filterslist of name
views.list.sortstring
pattern ^-?[a-z_]+$
views.list.group_bynamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
views.kanbanobject
views.kanban.group_by requirednamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
views.kanban.titlenamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
views.kanban.cardlist of name
at most 5
views.kanban.sumnamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
views.formobject
views.form.layout requiredlist of or
views.form.layout[].section requiredlabelA label in Bahasa Indonesia (required) and optionally English.
views.form.layout[].fieldslist of name
views.form.layout[].columnslist of list of name
at most 2
views.form.layout[].tablabelA label in Bahasa Indonesia (required) and optionally English.
realtimebooleanPush record changes to open screens (needs system.realtime).
default false
cachestringCache list reads for this long (needs system.cache).
pattern ^[0-9]+(s|m|h)$

description ​

An owner sentence or two in Bahasa Indonesia (required) and optionally English (contract 0060 §1).

PropertyTypeMeaning
id requiredstring
enstring

option ​

PropertyTypeMeaning
value requiredstring
pattern ^[a-z0-9_]+$
label requiredlabelA label in Bahasa Indonesia (required) and optionally English.
label.id requiredstring
label.enstring
toneneutral · info · ok · warn · bad · muted
probabilitynumber
min 0, max 100
closedboolean

field ​

PropertyTypeMeaning
name requirednamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
type requireddata · text · int · float · currency · percent · check · select · multiselect · link · dynamic_link · table · date · daterange · datetime · duration · phone · npwp · attach · image · rating · color · json · signature · money · geo
labellabelA label in Bahasa Indonesia (required) and optionally English.
label.id requiredstring
label.enstring
requiredboolean
defaultCELA CEL expression (plus Rangka helpers)
computeCELA CEL expression (plus Rangka helpers)
depends_onCELA CEL expression (plus Rangka helpers)
read_onlyboolean
set_oncebooleanA client may fill the field while it is empty but never change a value it holds (proof: clock-in time, position, photo); flows and other kernel writes may (contract 0030 §4)
hiddenboolean
in_listboolean
in_filterboolean
uniqueboolean
indexboolean
helplabelA label in Bahasa Indonesia (required) and optionally English.
help.id requiredstring
help.enstring
tonamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
ofnamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
currency_fieldnamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
rate_fieldnamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
peeklist of name
at most 6
optionslist of object
at least 1
options[].value requiredstring
pattern ^[a-z0-9_]+$
options[].label requiredlabelA label in Bahasa Indonesia (required) and optionally English.
options[].label.id requiredstring
options[].label.enstring
options[].toneneutral · info · ok · warn · bad · muted
options[].probabilitynumber
min 0, max 100
options[].closedboolean
chipboolean
relative_tonamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
min_rowsinteger
min 0
read_only_forlist of name
hidden_forlist of name
moneybooleanMoney field (currency fields are money by default). Changes are high risk.
stockbooleanQuantity that moves stock. Changes are high risk.

rule ​

PropertyTypeMeaning
name requirednamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
on requiredsave · submit · cancel
levelerror · warn · info
check requiredCELA CEL expression (plus Rangka helpers)
message requiredlabelA label in Bahasa Indonesia (required) and optionally English.
message.id requiredstring
message.enstring

permission ​

PropertyTypeMeaning
role requirednamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
ifCELA CEL expression (plus Rangka helpers)
readboolean
createboolean
writeboolean
deleteboolean
submitboolean
cancelboolean
amendboolean
exportboolean
importboolean
printboolean
customizeboolean

section ​

PropertyTypeMeaning
section requiredlabelA label in Bahasa Indonesia (required) and optionally English.
section.id requiredstring
section.enstring
fieldslist of name
columnslist of list of name
at most 2
tablabelA label in Bahasa Indonesia (required) and optionally English.
tab.id requiredstring
tab.enstring

approval ​

PropertyTypeMeaning
name requirednamesnake_case, never renamed once released
pattern ^[a-z][a-z0-9_]{0,62}$
on requirednamesubmit, cancel or an action name of this model
pattern ^[a-z][a-z0-9_]{0,62}$
whenCELPolicy applies only when this is true (absent = always)
approvers requiredlist of nameRoles that may approve; owner always may
at least 1
labellabelA label in Bahasa Indonesia (required) and optionally English.
label.id requiredstring
label.enstring

stock_rule ​

PropertyTypeMeaning
lines requirednameTable field whose rows move
pattern ^[a-z][a-z0-9_]{0,62}$
instringOutlet the rows come into: a header link field, or line.<field>
pattern ^(line\.)?[a-z][a-z0-9_]{0,62}$
outstringOutlet the rows leave: a header link field, or line.<field>
pattern ^(line\.)?[a-z][a-z0-9_]{0,62}$
itemnameLine link to item (default item)
pattern ^[a-z][a-z0-9_]{0,62}$
qtynameLine quantity in stock uom (default stock_qty when the line has it, else qty)
pattern ^[a-z][a-z0-9_]{0,62}$
ifCELPer line, with doc and line; false skips the line
reason requirednameAn option of stock_move.reason
pattern ^[a-z][a-z0-9_]{0,62}$
exploderecipeout: consume through the item's active recipe; in: bring its materials back (cost average or source)
costaverage or object or object or object or objectin only: average (default), {unit: f}, {amount: f}, {source: link},
cogsnameout only: read-only currency line field that gets the value the line took out
pattern ^[a-z][a-z0-9_]{0,62}$

Example ​

From rangka-apps/modules/pipeline/models/deal.rk (first 60 lines):

yaml
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
name: deal
label: {id: Peluang, en: Deal}
icon: card
naming: DEAL-{#####}
title_field: deal_name
realtime: true
permissions:
  - {role: sales_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
  - {role: finance_manager, read: true}
  - {role: purchasing_manager, read: true}
  - {role: project_admin, read: true}
  - {role: head_office, read: true}
  - {role: outlet_staff, read: true}
  - {role: sales_rep, read: true, create: true, write: true, if: owner == user.name}
fields:
  - name: deal_name
    type: data
    label: {id: Judul peluang}
    required: true
    in_list: true
  - name: customer
    type: link
    to: customer
    label: {id: Pelanggan}
    required: true
    in_list: true
    peek: [outstanding, payment_days]
  - name: contact_person
    type: data
    label: {id: Kontak}
  - name: stage
    type: select
    label: {id: Tahap}
    default: "'prospect'"
    in_list: true
    chip: true
    options:
      - value: prospect
        label: {id: Prospek}
        probability: 10
      - value: qualified
        label: {id: Kualifikasi}
        probability: 25
      - value: proposal
        label: {id: Penawaran}
        probability: 50
      - value: negotiation
        label: {id: Negosiasi}
        probability: 75
      - value: won
        label: {id: Menang}
        probability: 100
        tone: ok
        closed: true
      - value: lost
        label: {id: Kalah}
        probability: 0
        tone: bad
        closed: true

Generated from the schema by website/scripts/gen-reference.mjs. Edit the schema, not this page.

Rangka OS is source-available under the Elastic License 2.0 (ELv2). Free to self-host.