@rangka-os/create 0.5.0-alpha.28 → 0.5.0-alpha.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/jasa_proyek/app.rk +3 -0
  3. package/template/base/apps/pembukuan/app.rk +3 -0
  4. package/template/base/modules/accounting/flows/gl_asset_disposal_post.rk +68 -0
  5. package/template/base/modules/accounting/flows/gl_asset_disposal_reverse.rk +194 -0
  6. package/template/base/modules/accounting/flows/gl_depreciation_run_post.rk +43 -0
  7. package/template/base/modules/accounting/flows/gl_depreciation_run_reverse.rk +36 -0
  8. package/template/base/modules/accounting/flows/gl_fixed_asset_post.rk +51 -0
  9. package/template/base/modules/accounting/flows/gl_fixed_asset_reverse.rk +194 -0
  10. package/template/base/modules/accounting/flows/gl_vendor_bill_post.rk +2 -2
  11. package/template/base/modules/accounting/models/gl_entry.rk +2 -0
  12. package/template/base/modules/accounting/module.rk +2 -2
  13. package/template/base/modules/fixed_assets/flows/asset_disposal_on_cancel.rk +14 -0
  14. package/template/base/modules/fixed_assets/flows/asset_disposal_on_submit.rk +21 -0
  15. package/template/base/modules/fixed_assets/flows/asset_from_vendor_bill.rk +41 -0
  16. package/template/base/modules/fixed_assets/flows/depreciation_run_fill.rk +28 -0
  17. package/template/base/modules/fixed_assets/flows/depreciation_run_monthly.rk +36 -0
  18. package/template/base/modules/fixed_assets/flows/depreciation_run_on_cancel.rk +30 -0
  19. package/template/base/modules/fixed_assets/flows/depreciation_run_on_submit.rk +34 -0
  20. package/template/base/modules/fixed_assets/flows/fixed_asset_on_cancel.rk +24 -0
  21. package/template/base/modules/fixed_assets/flows/fixed_asset_on_submit.rk +69 -0
  22. package/template/base/modules/fixed_assets/flows/fixed_assets_setup.rk +29 -0
  23. package/template/base/modules/fixed_assets/flows/opening_balance_asset_guard.rk +15 -0
  24. package/template/base/modules/fixed_assets/flows/vendor_bill_asset_guard.rk +14 -0
  25. package/template/base/modules/fixed_assets/imports/asset_list.rk +22 -0
  26. package/template/base/modules/fixed_assets/models/asset_bill_line.rk +24 -0
  27. package/template/base/modules/fixed_assets/models/asset_book.rk +83 -0
  28. package/template/base/modules/fixed_assets/models/asset_category.rk +54 -0
  29. package/template/base/modules/fixed_assets/models/asset_disposal.rk +97 -0
  30. package/template/base/modules/fixed_assets/models/asset_guard.rk +90 -0
  31. package/template/base/modules/fixed_assets/models/depreciation_line.rk +13 -0
  32. package/template/base/modules/fixed_assets/models/depreciation_run.rk +65 -0
  33. package/template/base/modules/fixed_assets/models/fixed_asset.rk +165 -0
  34. package/template/base/modules/fixed_assets/models/fixed_asset_setting.rk +34 -0
  35. package/template/base/modules/fixed_assets/module.rk +30 -0
  36. package/template/base/modules/fixed_assets/print/fixed_asset_register.html +45 -0
  37. package/template/base/modules/fixed_assets/print/fixed_asset_register.rk +17 -0
  38. package/template/base/modules/procurement/models/vendor_bill.rk +7 -1
  39. package/template/base/modules/procurement/module.rk +2 -2
  40. package/template/base/modules/rental/models/rental_unit.rk +13 -3
  41. package/template/base/modules/rental/module.rk +2 -2
@@ -0,0 +1,97 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # Pelepasan aset: an asset sold or written off (lost, broken beyond repair), picked from the register (asset_book). Its
3
+ # cost, depreciation and book value are read from the register while it is a draft and frozen at submit; the submit
4
+ # journals them (accounting flow gl_asset_disposal_post: the gain or loss on 4-9300) and marks the register row (flow
5
+ # asset_disposal_on_submit, which refuses a second disposal of the same asset). A disposal dated before the end of the
6
+ # asset's last depreciated month is refused: cancel that run first, or date the disposal after it.
7
+ name: asset_disposal
8
+ label: {id: Pelepasan aset, en: Asset disposal}
9
+ icon: logout-box-r-line
10
+ is_submittable: true
11
+ naming: ADS-{YYYY}-{####}
12
+ title_field: book
13
+ permissions:
14
+ - {role: finance_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
15
+ - {role: head_office, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
16
+ fields:
17
+ - name: book
18
+ type: link
19
+ to: asset_book
20
+ label: {id: Aset}
21
+ required: true
22
+ in_list: true
23
+ peek: [asset_name, book_value, state]
24
+ # the asset document behind the register row (journal party); the form shows the register row as Aset
25
+ - {name: asset, type: link, to: fixed_asset, label: {id: Dokumen aset}, compute: book.asset, hidden: true}
26
+ - {name: disposal_date, type: date, label: {id: Tanggal}, required: true, default: today(), in_list: true}
27
+ - name: kind
28
+ type: select
29
+ label: {id: Jenis}
30
+ required: true
31
+ default: "'sold'"
32
+ in_list: true
33
+ options:
34
+ - {value: sold, label: {id: Dijual}}
35
+ - {value: written_off, label: {id: 'Dihapus (hilang, rusak)'}}
36
+ - name: proceeds
37
+ type: currency
38
+ label: {id: Harga jual}
39
+ default: '0'
40
+ depends_on: kind == 'sold'
41
+ - name: received_in
42
+ type: select
43
+ label: {id: Diterima di}
44
+ default: "'bank'"
45
+ depends_on: kind == 'sold'
46
+ options:
47
+ - {value: cash, label: {id: Kas}}
48
+ - {value: bank, label: {id: Bank}}
49
+ - {value: receivable, label: {id: Belum dibayar (piutang)}}
50
+ - {name: buyer, type: data, label: {id: Pembeli}, depends_on: kind == 'sold'}
51
+ - {name: outlet, type: data, label: {id: Cabang}, hidden: true, compute: book.outlet}
52
+ - {name: project, type: data, label: {id: Proyek}, hidden: true, compute: book.project}
53
+ - {name: cost, type: currency, label: {id: Harga perolehan}, compute: book.cost}
54
+ - name: accumulated_total
55
+ type: currency
56
+ label: {id: Akumulasi penyusutan}
57
+ compute: book.opening_accumulated + book.accumulated
58
+ - {name: book_value, type: currency, label: {id: Nilai buku}, compute: cost - accumulated_total, in_list: true}
59
+ - name: gain_loss
60
+ type: currency
61
+ label: {id: Laba (rugi) pelepasan}
62
+ compute: proceeds - book_value
63
+ in_list: true
64
+ - {name: notes, type: text, label: {id: Catatan}}
65
+ rules:
66
+ - name: asset_in_use
67
+ on: save
68
+ check: book.state in ['active', 'fully_depreciated']
69
+ message: {id: 'Aset ini belum diajukan, atau sudah dijual atau dihapus'}
70
+ - name: not_before_purchase
71
+ on: save
72
+ check: disposal_date >= book.acquisition_date
73
+ message: {id: Tanggal pelepasan tidak boleh sebelum aset dicatat}
74
+ - name: after_last_run
75
+ on: save
76
+ check: book.depreciated_through == '' || disposal_date >= add_months(string(book.depreciated_through), 1) - duration(1)
77
+ message: {id: 'Aset sudah disusutkan sampai bulan setelah tanggal ini. Batalkan penyusutan bulan itu dulu, atau ubah tanggalnya'}
78
+ - name: proceeds_by_kind
79
+ on: save
80
+ check: proceeds >= 0 && (kind == 'sold' || proceeds == 0)
81
+ message: {id: 'Harga jual tidak boleh negatif, dan aset yang dihapus tidak punya harga jual'}
82
+ views:
83
+ list:
84
+ columns: [name, book, disposal_date, kind, book_value, proceeds, gain_loss, status]
85
+ sort: -disposal_date
86
+ form:
87
+ layout:
88
+ - section: {id: Aset}
89
+ columns:
90
+ - [book, disposal_date, kind]
91
+ - [proceeds, received_in, buyer]
92
+ - section: {id: Nilai}
93
+ columns:
94
+ - [cost, accumulated_total, book_value]
95
+ - [gain_loss]
96
+ - section: {id: Catatan}
97
+ fields: [notes]
@@ -0,0 +1,90 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # Never stored: a flow of this module creates one when the document it runs in must be refused (the pattern of
3
+ # rental_guard); the matching rule fails with the reason's message, which rolls the whole submit or cancel back.
4
+ name: asset_guard
5
+ label: {id: Penjaga aset tetap, en: Fixed asset guard}
6
+ icon: check
7
+ naming: AGD-{######}
8
+ title_field: reason
9
+ permissions:
10
+ - {role: finance_manager, create: true}
11
+ - {role: head_office, create: true}
12
+ - {role: purchasing_manager, create: true}
13
+ fields:
14
+ - name: reason
15
+ type: select
16
+ label: {id: Alasan}
17
+ required: true
18
+ options:
19
+ - {value: below_threshold, label: {id: Di bawah batas kapitalisasi}}
20
+ - {value: bill_currency, label: {id: Tagihan valas}}
21
+ - {value: bill_line_taken, label: {id: Baris tagihan sudah jadi aset}}
22
+ - {value: bill_has_asset, label: {id: Tagihan sudah jadi aset}}
23
+ - {value: bill_cost, label: {id: Harga tidak sama dengan baris tagihan}}
24
+ - {value: opening_twice, label: {id: Aset tetap di saldo awal dua kali}}
25
+ - {value: disposal_stale, label: {id: Nilai aset berubah}}
26
+ - {value: unit_taken, label: {id: Unit sewa sudah jadi aset lain}}
27
+ - {value: asset_in_use, label: {id: Aset sudah disusutkan atau dilepas}}
28
+ - {value: run_exists, label: {id: Penyusutan bulan itu sudah ada}}
29
+ - {value: run_not_latest, label: {id: Bukan penyusutan terakhir}}
30
+ - {value: run_stale, label: {id: Daftar aset berubah}}
31
+ - {value: run_disposed, label: {id: Aset sudah dilepas}}
32
+ - {value: disposal_taken, label: {id: Aset sudah dilepas}}
33
+ - {name: document, type: data, label: {id: Dokumen}}
34
+ rules:
35
+ - name: below_threshold
36
+ on: save
37
+ check: reason != 'below_threshold'
38
+ message: {id: 'Nilainya di bawah batas kapitalisasi di Pengaturan aset tetap: catat sebagai beban, bukan aset tetap.'}
39
+ - name: bill_currency
40
+ on: save
41
+ check: reason != 'bill_currency'
42
+ message: {id: 'Tagihan valas belum bisa dicatat sebagai aset tetap. Catat dalam rupiah.'}
43
+ - name: bill_line_taken
44
+ on: save
45
+ check: reason != 'bill_line_taken'
46
+ message: {id: 'Baris tagihan ini sudah menjadi aset tetap lain yang diajukan.'}
47
+ - name: bill_has_asset
48
+ on: save
49
+ check: reason != 'bill_has_asset'
50
+ message: {id: 'Tagihan ini sudah menjadi aset tetap yang diajukan. Batalkan asetnya dulu.'}
51
+ - name: bill_cost
52
+ on: save
53
+ check: reason != 'bill_cost'
54
+ message: {id: 'Harga perolehan aset dari tagihan harus sama dengan nilai baris tagihannya (termasuk bagian PPN bila usaha bukan PKP).'}
55
+ - name: opening_twice
56
+ on: save
57
+ check: reason != 'opening_twice'
58
+ message: {id: 'Aset tetap sudah tercatat di Saldo awal dan per aset sekaligus. Pakai salah satu saja.'}
59
+ - name: disposal_stale
60
+ on: save
61
+ check: reason != 'disposal_stale'
62
+ message: {id: 'Penyusutan aset ini berubah sejak pelepasan dibuat. Simpan ulang pelepasan supaya nilainya terbaru, lalu ajukan lagi.'}
63
+ - name: unit_taken
64
+ on: save
65
+ check: reason != 'unit_taken'
66
+ message: {id: 'Unit alat sewa ini sudah tercatat sebagai aset tetap lain.'}
67
+ - name: asset_in_use
68
+ on: save
69
+ check: reason != 'asset_in_use'
70
+ message: {id: 'Aset ini sudah disusutkan atau dilepas. Batalkan penyusutan atau pelepasannya dulu.'}
71
+ - name: run_exists
72
+ on: save
73
+ check: reason != 'run_exists'
74
+ message: {id: 'Penyusutan bulan ini atau bulan sesudahnya sudah diajukan.'}
75
+ - name: run_not_latest
76
+ on: save
77
+ check: reason != 'run_not_latest'
78
+ message: {id: 'Hanya penyusutan bulan terakhir yang bisa dibatalkan. Batalkan bulan sesudahnya dulu.'}
79
+ - name: run_stale
80
+ on: save
81
+ check: reason != 'run_stale'
82
+ message: {id: 'Daftar aset sudah berubah sejak draft dibuat. Hapus draft ini dan buat penyusutan bulan itu lagi.'}
83
+ - name: run_disposed
84
+ on: save
85
+ check: reason != 'run_disposed'
86
+ message: {id: 'Ada aset di penyusutan ini yang sudah dijual atau dihapus. Batalkan pelepasannya dulu.'}
87
+ - name: disposal_taken
88
+ on: save
89
+ check: reason != 'disposal_taken'
90
+ message: {id: 'Aset ini sudah dijual atau dihapus.'}
@@ -0,0 +1,13 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # One asset in a monthly depreciation run, written by flow depreciation_run_fill. months: how many months this line
3
+ # covers (more than 1 when an asset's earlier months had no run yet, so nothing is skipped); prev_through: the asset's
4
+ # last depreciated month before this run, put back when the run is cancelled.
5
+ name: depreciation_line
6
+ is_child: true
7
+ fields:
8
+ - {name: asset, type: link, to: fixed_asset, label: {id: Aset}, required: true}
9
+ - {name: months, type: int, label: {id: Bulan}, default: '1'}
10
+ - {name: amount, type: currency, label: {id: Penyusutan}, required: true}
11
+ - {name: outlet, type: link, to: outlet, label: {id: Cabang}, depends_on: app_installed('outlets')}
12
+ - {name: project, type: data, label: {id: Proyek}, depends_on: app_installed('projects')}
13
+ - {name: prev_through, type: date, label: {id: Sebelumnya disusutkan sampai}, hidden: true}
@@ -0,0 +1,65 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # Penyusutan bulanan: one document per month (period = its first day). Flow depreciation_run_fill lists the assets
3
+ # when the draft is made: every submitted asset still active whose depreciation started on or before the month, with
4
+ # what it is owed up to that month (one month, or more when earlier months had no run), never past its residual value.
5
+ # Its submit journals each line (accounting flow gl_depreciation_run_post, on the last day of the month) and adds the
6
+ # amounts to the assets (flow depreciation_run_on_submit, which refuses a run whose lines no longer match the assets,
7
+ # a second run for the month, or a run older than one already submitted). Only the latest run may be cancelled.
8
+ name: depreciation_run
9
+ label: {id: Penyusutan bulanan, en: Monthly depreciation}
10
+ icon: line-chart-line
11
+ is_submittable: true
12
+ naming: 'DEP-{period_key}-{##}'
13
+ title_field: title
14
+ permissions:
15
+ - {role: finance_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, export: true, print: true}
16
+ - {role: head_office, read: true, create: true, write: true, delete: true, submit: true, cancel: true, export: true, print: true}
17
+ fields:
18
+ - name: period
19
+ type: date
20
+ label: {id: Bulan (tanggal 1)}
21
+ required: true
22
+ in_list: true
23
+ default: "add_months(truncate(string(today()), 7) + '-01', -1)"
24
+ - {name: title, type: data, label: {id: Judul}, compute: "'Penyusutan ' + truncate(string(period), 7)"}
25
+ # the month as YYYY-MM, for the document number (DEP-2026-10-01: the first run of October 2026)
26
+ - {name: period_key, type: data, label: {id: Kode bulan}, hidden: true, compute: "truncate(string(period), 7)"}
27
+ - name: posting_date
28
+ type: date
29
+ label: {id: Tanggal jurnal}
30
+ compute: "add_months(string(period), 1) - duration(1)"
31
+ in_list: true
32
+ - {name: lines, type: table, of: depreciation_line, label: {id: Aset yang disusutkan}}
33
+ # not named `total`: the web app reads a field `total` as an amount to be paid (docSummary)
34
+ - {name: total_depreciation, type: currency, label: {id: Total penyusutan}, compute: "lines.map(l, l.amount).sum()", in_list: true}
35
+ - {name: asset_count, type: int, label: {id: Jumlah aset}, compute: size(lines), in_list: true}
36
+ - {name: notes, type: text, label: {id: Catatan}}
37
+ rules:
38
+ - name: period_is_month_start
39
+ on: save
40
+ check: "string(period) == truncate(string(period), 7) + '-01'"
41
+ message: {id: Bulan penyusutan diisi tanggal 1 bulan itu}
42
+ # a month is depreciated once it is over: never the current month or a later one (audit F4: a run dated in the future
43
+ # would post ahead and block every earlier month)
44
+ - name: period_over
45
+ on: save
46
+ check: "string(period) < truncate(string(today()), 7) + '-01'"
47
+ message: {id: 'Penyusutan dibuat setelah bulannya selesai: pilih bulan lalu atau sebelumnya'}
48
+ - name: amounts_positive
49
+ on: save
50
+ check: "lines.map(l, l.amount <= 0 ? 1 : 0).sum() == 0"
51
+ message: {id: Nilai penyusutan per aset harus lebih dari 0}
52
+ views:
53
+ list:
54
+ columns: [name, period, posting_date, asset_count, total_depreciation, status]
55
+ sort: -period
56
+ form:
57
+ layout:
58
+ - section: {id: Bulan}
59
+ columns:
60
+ - [period, posting_date]
61
+ - [asset_count, total_depreciation]
62
+ - section: {id: Aset yang disusutkan}
63
+ fields: [lines]
64
+ - section: {id: Catatan}
65
+ fields: [notes]
@@ -0,0 +1,165 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # One fixed asset (a camera body, a car, a laptop) depreciated straight-line per month: (cost - residual value) /
3
+ # useful life, rounded to the rupiah; the last month takes what is left, so the depreciation adds up to the cost minus
4
+ # the residual exactly. Its submit journals the purchase by its source (accounting flow gl_fixed_asset_post, none for
5
+ # a vendor bill: the bill already debited 1-2100) and opens its asset_book (flow fixed_asset_on_submit): a submitted
6
+ # document cannot change, so the accumulated depreciation, the last month depreciated and the state live there,
7
+ # written only by the flows of this module. Cancelling an asset that has been depreciated or disposed of is refused.
8
+ name: fixed_asset
9
+ label: {id: Aset tetap, en: Fixed asset}
10
+ icon: building-2-line
11
+ is_submittable: true
12
+ naming: AST-{YYYY}-{####}
13
+ title_field: asset_name
14
+ permissions:
15
+ - {role: finance_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true, import: true}
16
+ - {role: head_office, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true, import: true}
17
+ # the bill's submit drafts the assets (flow asset_from_vendor_bill runs as the purchasing manager); finance completes
18
+ # and submits them
19
+ - {role: purchasing_manager, read: true, create: true}
20
+ # the warehouse sees which unit is which asset, not what it cost (hidden_for below, contract 0027)
21
+ - {role: rental_staff, read: true}
22
+ fields:
23
+ - {name: asset_name, type: data, label: {id: Nama aset}, required: true, in_list: true}
24
+ - name: category
25
+ type: link
26
+ to: asset_category
27
+ label: {id: Kelompok aset}
28
+ in_list: true
29
+ peek: [useful_life_months, residual_percent, fiscal_group]
30
+ - name: source
31
+ type: select
32
+ label: {id: Asal aset}
33
+ required: true
34
+ default: "'other'"
35
+ options:
36
+ - {value: vendor_bill, label: {id: Dibeli lewat tagihan pemasok}}
37
+ - {value: opening, label: {id: Aset lama (saldo awal)}}
38
+ - {value: other, label: {id: Dibeli tunai atau transfer tanpa tagihan}}
39
+ - name: vendor_bill
40
+ type: link
41
+ to: vendor_bill
42
+ label: {id: Tagihan pemasok}
43
+ depends_on: app_installed('procurement') && source == 'vendor_bill'
44
+ # the bill line this asset came from (its idx): its submit checks the cost against asset_bill_line, which only the
45
+ # bill's flow writes (audit F1: a cost typed by hand never reaches the register)
46
+ - {name: bill_line, type: int, label: {id: Baris tagihan}, hidden: true}
47
+ - name: paid_from
48
+ type: select
49
+ label: {id: Dibayar dari}
50
+ default: "'bank'"
51
+ depends_on: source == 'other'
52
+ options:
53
+ - {value: cash, label: {id: Kas}}
54
+ - {value: bank, label: {id: Bank}}
55
+ - {name: acquisition_date, type: date, label: {id: Tanggal beli}, required: true, in_list: true}
56
+ - name: book_date
57
+ type: date
58
+ label: {id: Tanggal dicatat di buku}
59
+ help: {id: 'Aset lama: tanggal saldo awal pembukuan. Selain itu sama dengan tanggal beli'}
60
+ default: acquisition_date
61
+ relative_to: acquisition_date
62
+ required: true
63
+ - name: cost
64
+ type: currency
65
+ label: {id: Harga perolehan}
66
+ required: true
67
+ in_list: true
68
+ hidden_for: [rental_staff]
69
+ - name: useful_life_months
70
+ type: int
71
+ label: {id: Umur manfaat (bulan)}
72
+ default: category.useful_life_months
73
+ - name: residual_value
74
+ type: currency
75
+ label: {id: Nilai sisa}
76
+ help: {id: 'Perkiraan nilai jual di akhir umur manfaat. Tidak ikut disusutkan'}
77
+ default: "round(cost * category.residual_percent / 100)"
78
+ hidden_for: [rental_staff]
79
+ - name: depreciation_start
80
+ type: date
81
+ label: {id: Mulai disusutkan}
82
+ help: {id: 'Bulan pertama penyusutan, biasanya bulan setelah aset dibeli atau dicatat'}
83
+ default: "add_months(truncate(string(book_date), 7) + '-01', 1)"
84
+ required: true
85
+ - name: opening_accumulated
86
+ type: currency
87
+ label: {id: Akumulasi penyusutan sebelumnya}
88
+ help: {id: 'Aset lama: penyusutan yang sudah dicatat sampai tanggal saldo awal'}
89
+ default: '0'
90
+ depends_on: source == 'opening'
91
+ hidden_for: [rental_staff]
92
+ - {name: outlet, type: link, to: outlet, label: {id: Cabang}, in_list: true, depends_on: app_installed('outlets')}
93
+ - {name: project, type: link, to: project, label: {id: Proyek}, depends_on: app_installed('projects')}
94
+ - {name: rental_unit, type: link, to: rental_unit, label: {id: Unit alat sewa}, depends_on: app_installed('rental')}
95
+ - {name: serial_no, type: data, label: {id: Nomor seri}}
96
+ - name: monthly_depreciation
97
+ type: currency
98
+ label: {id: Penyusutan per bulan}
99
+ compute: "useful_life_months > 0 ? round((cost - residual_value) / useful_life_months) : 0"
100
+ hidden_for: [rental_staff]
101
+ - {name: notes, type: text, label: {id: Catatan}}
102
+ rules:
103
+ - name: cost_positive
104
+ on: save
105
+ check: cost > 0
106
+ message: {id: Harga perolehan harus lebih dari 0}
107
+ - name: residual_below_cost
108
+ on: save
109
+ check: residual_value >= 0 && residual_value < cost
110
+ message: {id: Nilai sisa tidak boleh negatif dan harus di bawah harga perolehan}
111
+ # A draft made by a vendor bill's submit has no category or life yet: finance completes it, so these two are checked
112
+ # at submit only.
113
+ - name: category_set
114
+ on: submit
115
+ check: category != ''
116
+ message: {id: Pilih kelompok aset dulu}
117
+ - name: life_positive
118
+ on: submit
119
+ check: useful_life_months > 0 && useful_life_months <= 600
120
+ message: {id: Umur manfaat antara 1 dan 600 bulan}
121
+ - name: depreciation_positive
122
+ on: submit
123
+ check: monthly_depreciation > 0 || opening_accumulated >= cost - residual_value
124
+ message: {id: 'Penyusutan per bulan 0 rupiah: harga dikurangi nilai sisa terlalu kecil untuk umur manfaatnya'}
125
+ - name: start_is_month_start
126
+ on: save
127
+ check: "string(depreciation_start) == truncate(string(depreciation_start), 7) + '-01'"
128
+ message: {id: Mulai disusutkan selalu tanggal 1}
129
+ - name: start_after_book
130
+ on: save
131
+ check: depreciation_start > book_date
132
+ message: {id: 'Penyusutan dimulai bulan setelah aset dicatat di buku'}
133
+ - name: book_not_before_purchase
134
+ on: save
135
+ check: book_date >= acquisition_date
136
+ message: {id: Tanggal dicatat di buku tidak boleh sebelum tanggal beli}
137
+ - name: opening_accumulated_range
138
+ on: save
139
+ check: "opening_accumulated >= 0 && opening_accumulated <= cost - residual_value && (source == 'opening' || opening_accumulated == 0)"
140
+ message: {id: 'Akumulasi penyusutan sebelumnya hanya untuk aset lama, dan tidak boleh melebihi harga dikurangi nilai sisa'}
141
+ - name: bill_source
142
+ on: submit
143
+ check: "source != 'vendor_bill' || (vendor_bill != '' && vendor_bill.docstatus == 1 && vendor_bill.posting == 'asset')"
144
+ message: {id: 'Aset dari tagihan pemasok: tagihannya harus sudah diajukan sebagai Aset tetap'}
145
+ - name: bill_only_from_bill
146
+ on: save
147
+ check: source == 'vendor_bill' || vendor_bill == ''
148
+ message: {id: 'Aset yang menunjuk tagihan pemasok berasal dari tagihan itu'}
149
+ views:
150
+ list:
151
+ columns: [name, asset_name, category, outlet, acquisition_date, cost, status]
152
+ filters: [category, outlet, source]
153
+ sort: -acquisition_date
154
+ form:
155
+ layout:
156
+ - section: {id: Aset}
157
+ columns:
158
+ - [asset_name, category, serial_no, outlet, project, rental_unit]
159
+ - [source, vendor_bill, paid_from, acquisition_date, book_date]
160
+ - section: {id: Penyusutan}
161
+ columns:
162
+ - [cost, residual_value, useful_life_months, depreciation_start, opening_accumulated]
163
+ - [monthly_depreciation]
164
+ - section: {id: Catatan}
165
+ fields: [notes]
@@ -0,0 +1,34 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # One record per business (`key` is unique and always 'usaha'), made with the default categories by flow
3
+ # fixed_assets_setup (run on the 1st with the monthly depreciation, or by hand from the flow list). The capitalisation
4
+ # threshold (batas kapitalisasi): a purchase below it is an expense, not an asset. Rp 1.000.000 by default, the common
5
+ # policy of Indonesian SMEs under SAK EMKM, which leaves the threshold to the business (DECISIONS.md, rangka-apps#113).
6
+ # 0 turns the check off.
7
+ name: fixed_asset_setting
8
+ label: {id: Pengaturan aset tetap, en: Fixed asset settings}
9
+ icon: settings-3-line
10
+ naming: AST-SET-{##}
11
+ title_field: title
12
+ permissions:
13
+ - {role: finance_manager, read: true, create: true, write: true}
14
+ - {role: head_office, read: true, create: true, write: true}
15
+ # the bill's flow (asset_from_vendor_bill) runs as the purchasing manager who submits it and reads the threshold
16
+ - {role: purchasing_manager, read: true}
17
+ fields:
18
+ - {name: key, type: data, label: {id: Kunci}, default: "'usaha'", required: true, unique: true, read_only: true}
19
+ - {name: title, type: data, label: {id: Nama}, compute: "'Pengaturan aset tetap'"}
20
+ - name: capitalisation_threshold
21
+ type: currency
22
+ label: {id: Batas kapitalisasi}
23
+ help: {id: 'Pembelian di bawah nilai ini dicatat sebagai beban, bukan aset tetap. Isi 0 bila semua pembelian boleh jadi aset.'}
24
+ default: '1000000'
25
+ rules:
26
+ - name: threshold_not_negative
27
+ on: save
28
+ check: capitalisation_threshold >= 0
29
+ message: {id: Batas kapitalisasi tidak boleh negatif}
30
+ views:
31
+ form:
32
+ layout:
33
+ - section: {id: Aset tetap}
34
+ fields: [capitalisation_threshold]
@@ -0,0 +1,30 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
+ name: fixed_assets
3
+ version: 1.0.0
4
+ title: {id: Aset tetap, en: Fixed assets}
5
+ summary:
6
+ id: Catat aset tetap dan susutkan otomatis tiap bulan.
7
+ en: Record fixed assets and depreciate them every month.
8
+ category: finance
9
+ icon: building-2-line
10
+ # Fixed assets and their straight-line monthly depreciation (garis lurus, with a residual value), rangka-apps#113.
11
+ # An asset comes in three ways (fixed_asset.source): bought on a vendor bill whose posting is "Aset tetap" (the bill
12
+ # debits 1-2100 and flow asset_from_vendor_bill drafts one asset per bill line; the asset posts nothing itself), an old
13
+ # asset brought in with the depreciation it already had (opening, against 3-1900), or bought without a bill (cash or
14
+ # bank). Depreciation is a document per month (depreciation_run): flow depreciation_run_fill lists every asset due and
15
+ # its amount when the draft is made, and its submit journals 6-1950 Beban penyusutan against 1-2900 Akumulasi
16
+ # penyusutan per asset (with its outlet and project) and moves each asset's accumulated depreciation. On the 1st at
17
+ # 06:00 flow depreciation_run_monthly drafts last month's run and tells finance; a person submits it (nothing posts by
18
+ # itself). Selling or writing off an asset (asset_disposal) takes its cost and depreciation out and books the gain or
19
+ # loss on one signed account 4-9300. Journals are those of the accounting module (scripts/gen_accounting_flows.py).
20
+ # Fiscal depreciation (PMK 72/2023 groups, declining balance) is stored per category for later Coretax reports only.
21
+ # One setting per business (fixed_asset_setting): the capitalisation threshold, below which a purchase is an expense.
22
+ requires: {rangka: '>=0.5', users: ^1.2, accounting: ^1.4}
23
+ optional: {procurement: ^1.0, rental: ^1.0, outlets: ^1.0, projects: ^1.0}
24
+ notices:
25
+ - name: depreciation_ready
26
+ label: {id: Penyusutan bulanan siap diajukan, en: Monthly depreciation ready}
27
+ description: {id: 'Tiap tanggal 1: draft penyusutan bulan lalu sudah dibuat dan menunggu diperiksa dan diajukan.'}
28
+ severity: info
29
+ to: [owner, finance_manager, head_office]
30
+ can: {model: depreciation_run, action: read}
@@ -0,0 +1,45 @@
1
+ {{define "style"}}
2
+ .meta { width: 100%; margin: 12px 0; border-collapse: collapse; }
3
+ .meta td { padding: 2px 6px 2px 0; vertical-align: top; }
4
+ .items { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.9em; }
5
+ .items th, .items td { border-bottom: 1px solid #d6d3d1; padding: 5px 6px; text-align: left; }
6
+ .items th { border-bottom: 1px solid #1c1917; color: #57534e; font-weight: 600; }
7
+ .items tr.total td { border-top: 2px solid #1c1917; font-weight: 700; }
8
+ .num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
9
+ .note { margin-top: 14px; font-size: 0.9em; }
10
+ {{end}}
11
+ {{template "letterhead" .}}
12
+ <h1>Daftar aset tetap</h1>
13
+ <table class="meta">
14
+ <tr><td>Penyusutan bulan</td><td>: {{date .Doc.period}} s.d. {{date .Doc.posting_date}}</td><td>Dicetak</td><td>: {{date .Printed}}</td></tr>
15
+ <tr><td>Penyusutan bulan ini</td><td>: {{rupiah .Doc.total_depreciation}} ({{.Doc.asset_count}} aset)</td><td></td><td></td></tr>
16
+ </table>
17
+ <table class="items">
18
+ <thead><tr><th>Aset</th><th>Kelompok</th><th>Tanggal beli</th><th class="num">Harga perolehan</th><th class="num">Akumulasi penyusutan</th><th class="num">Nilai buku</th><th>Status</th></tr></thead>
19
+ <tbody>
20
+ {{range $b := .Related.books}}
21
+ <tr>
22
+ <td>{{$b.asset_name}}<br><small>{{$b.asset}}</small></td>
23
+ <td>{{$b.category_name}}</td>
24
+ <td>{{date $b.acquisition_date}}</td>
25
+ <td class="num">{{rupiah $b.cost}}</td>
26
+ <td class="num">{{rupiah $b.accumulated_total}}</td>
27
+ <td class="num">{{rupiah $b.book_value}}</td>
28
+ <td>{{$b.state_label}}</td>
29
+ </tr>
30
+ {{end}}
31
+ <tr class="total"><td colspan="3">Total</td><td class="num">{{rupiah (sum .Related.books "cost")}}</td><td class="num">{{rupiah (sum .Related.books "accumulated_total")}}</td><td class="num">{{rupiah (sum .Related.books "book_value")}}</td><td></td></tr>
32
+ </tbody>
33
+ </table>
34
+ <h2>Penyusutan bulan ini</h2>
35
+ <table class="items">
36
+ <thead><tr><th>Aset</th><th class="num">Bulan</th><th class="num">Penyusutan</th></tr></thead>
37
+ <tbody>
38
+ {{range $l := .Doc.lines}}
39
+ <tr><td>{{range $b := $.Related.books}}{{if eq $b.asset $l.asset}}{{$b.asset_name}}<br>{{end}}{{end}}<small>{{$l.asset}}</small></td><td class="num">{{$l.months}}</td><td class="num">{{rupiah $l.amount}}</td></tr>
40
+ {{end}}
41
+ <tr class="total"><td colspan="2">Total</td><td class="num">{{rupiah .Doc.total_depreciation}}</td></tr>
42
+ </tbody>
43
+ </table>
44
+ {{if .Truncated.books}}<p class="note"><strong>Daftar dipotong:</strong> hanya 1.000 aset pertama yang ditampilkan.</p>{{end}}
45
+ <p class="note">Nilai di daftar aset adalah nilai saat dicetak. Dicetak dari penyusutan bulan terakhir, nilainya adalah nilai akhir bulan itu.</p>
@@ -0,0 +1,17 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/print.json
2
+ # Daftar aset tetap, printed from a monthly depreciation run: every asset still held (asset_book Aktif or Habis
3
+ # disusutkan; sold, written-off and cancelled ones are out of the books) with its cost,
4
+ # accumulated depreciation and book value, by category, and this run's depreciation per asset. The register values are
5
+ # those of today: printed from the latest submitted run, they are the values at the end of its month. A4.
6
+ name: fixed_asset_register
7
+ model: depreciation_run
8
+ label: {id: Daftar aset tetap, en: Fixed asset register}
9
+ paper: A4
10
+ template: fixed_asset_register.html
11
+ related:
12
+ books:
13
+ model: asset_book
14
+ match: {}
15
+ filter: state in ['active', 'fully_depreciated']
16
+ sort: category
17
+ limit: 1000
@@ -155,7 +155,8 @@ fields:
155
155
  in_list: true
156
156
  # Accounting (module accounting): what the bill pays for. A project's cost goes to Biaya proyek; goods received
157
157
  # into stock through a goods receipt or PO (or consigned goods sold) clear "Utang belum ditagih", only where the
158
- # stock module keeps stock; anything else to the expense account chosen. The default follows the links on the bill.
158
+ # stock module keeps stock; a fixed asset (module fixed_assets) to Aset tetap, one draft asset per line (flow
159
+ # asset_from_vendor_bill); anything else to the expense account chosen. The default follows the links on the bill.
159
160
  - name: posting
160
161
  type: select
161
162
  label: {id: Dicatat sebagai}
@@ -165,6 +166,7 @@ fields:
165
166
  - {value: stock, label: {id: Barang dagang atau bahan (sudah diterima)}}
166
167
  - {value: project, label: {id: Biaya proyek}}
167
168
  - {value: expense, label: {id: Beban operasional}}
169
+ - {value: asset, label: {id: Aset tetap}}
168
170
  - name: expense_account
169
171
  type: select
170
172
  label: {id: Akun beban}
@@ -195,6 +197,10 @@ rules:
195
197
  on: save
196
198
  check: posting != 'stock' || app_installed('stock')
197
199
  message: {id: Tagihan barang dagang hanya untuk usaha yang mencatat stok; pilih Beban operasional atau Biaya proyek}
200
+ - name: posting_asset_needs_module
201
+ on: save
202
+ check: "posting != 'asset' || (app_installed('fixed_assets') && (currency == '' || currency == 'IDR') && (goods_receipt == '' || !app_installed('stock')))"
203
+ message: {id: 'Tagihan aset tetap hanya untuk usaha yang memakai modul Aset tetap, dalam rupiah, dan tanpa penerimaan barang ke stok'}
198
204
  - name: posting_project_needs_project
199
205
  on: save
200
206
  check: (posting != 'project' || project != '') && (project == '' || posting == 'project' || posting == null)
@@ -1,6 +1,6 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
2
  name: procurement
3
- version: 1.3.0
3
+ version: 1.4.0
4
4
  title: {id: Pembelian, en: Procurement}
5
5
  summary:
6
6
  id: Permintaan dan pesanan pembelian, barang datang dan tagihan pemasok.
@@ -8,7 +8,7 @@ summary:
8
8
  category: purchasing
9
9
  icon: shopping-bag-line
10
10
  requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, catalogue: ^1.0}
11
- optional: {outlets: ^1.0, currency: ^1.0, stock: ^1.4, projects: ^1.0}
11
+ optional: {outlets: ^1.0, currency: ^1.0, stock: ^1.4, projects: ^1.0, fixed_assets: ^1.0}
12
12
  # Semantics fixed in docs/kernel-hooks.md (section procurement). stock.post_moves is a core hook (goods_receipt.on_submit);
13
13
  # stock.reverse_moves (goods_receipt.on_cancel) is declared here too, since stock is optional for procurement (a no-op without it).
14
14
  hooks: [procurement.make_po, procurement.receive, procurement.post_payable, procurement.reverse_payable, stock.reverse_moves]
@@ -8,13 +8,16 @@ title_field: code
8
8
  # its serial number. An item with "Serah terima per unit" on (rental_item.track_units) goes out and comes back by
9
9
  # unit: the checkout and the return list which units, in what condition (checklist). Where the unit is (state,
10
10
  # booking, last documents) is written only by the flows of this module (rental_checkout_on_submit and the others);
11
- # the condition is also editable by hand, so a unit repaired or found again can go out again.
11
+ # the condition is also editable by hand, so a unit repaired or found again can go out again. With the fixed_assets
12
+ # module, `asset` is the fixed asset this unit is (written by that module's flows when the asset is submitted or
13
+ # cancelled), so its cost and depreciation are read per unit.
12
14
  permissions:
13
15
  - {role: finance_manager, read: true, create: true, write: true, export: true, print: true}
14
16
  # write: the checkout and return flows of whoever submits or cancels them update the unit (state fields read_only)
15
17
  - {role: sales_manager, read: true, create: true, write: true, export: true}
16
18
  - {role: rental_staff, read: true, write: true, export: true}
17
- - {role: head_office, read: true, export: true}
19
+ # write: only through the fixed_assets flows, which link the unit to its asset when head office submits one
20
+ - {role: head_office, read: true, write: true, export: true}
18
21
  fields:
19
22
  - {name: rental_item, type: link, to: rental_item, label: {id: Alat}, required: true, in_list: true}
20
23
  - name: code
@@ -53,6 +56,13 @@ fields:
53
56
  - {name: last_checkout, type: link, to: rental_checkout, label: {id: Alat keluar terakhir}, read_only: true}
54
57
  - {name: last_return, type: link, to: rental_return, label: {id: Alat kembali terakhir}, read_only: true}
55
58
  - {name: active, type: check, label: {id: Masih dipakai}, default: 'true'}
59
+ - name: asset
60
+ type: link
61
+ to: fixed_asset
62
+ label: {id: Aset tetap}
63
+ read_only: true
64
+ depends_on: app_installed('fixed_assets')
65
+ peek: [asset_name, acquisition_date]
56
66
  - {name: notes, type: text, label: {id: Catatan}}
57
67
  rules:
58
68
  # A unit out with a booking stays a unit of the booked item until it comes back (audit 8 Nov L2): moving it to another
@@ -71,7 +81,7 @@ views:
71
81
  - section: {id: Unit}
72
82
  columns:
73
83
  - [rental_item, code, serial_no, active]
74
- - [condition, state, booking]
84
+ - [condition, state, booking, asset]
75
85
  - section: {id: Riwayat}
76
86
  columns:
77
87
  - [last_checkout]