@rangka-os/create 0.5.0-alpha.27 → 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 (220) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/absen_karyawan/app.rk +37 -0
  3. package/template/base/apps/absen_karyawan/dashboards/absen_hari_ini.rk +20 -0
  4. package/template/base/apps/absen_karyawan/dashboards/absen_karyawan_saya.rk +14 -0
  5. package/template/base/apps/absen_karyawan/dashboards/rekap_absen_karyawan.rk +12 -0
  6. package/template/base/apps/jasa_proyek/app.rk +4 -1
  7. package/template/base/apps/kasir/app.rk +5 -1
  8. package/template/base/apps/kasir/dashboards/kasir_ringkas.rk +4 -0
  9. package/template/base/apps/kasir/skills/rangka-app-kasir/SKILL.md +20 -0
  10. package/template/base/apps/pembukuan/app.rk +3 -0
  11. package/template/base/connectors/midtrans/connector.rk +249 -0
  12. package/template/base/connectors/midtrans/fixtures/charge_gopay.json +34 -0
  13. package/template/base/connectors/midtrans/fixtures/charge_qris.json +23 -0
  14. package/template/base/connectors/midtrans/fixtures/charge_va.json +20 -0
  15. package/template/base/connectors/midtrans/fixtures/create_snap.json +4 -0
  16. package/template/base/connectors/midtrans/fixtures/expect.json +88 -0
  17. package/template/base/connectors/midtrans/fixtures/get_status.json +15 -0
  18. package/template/base/connectors/midtrans/fixtures/payment_notified.json +28 -0
  19. package/template/base/connectors/midtrans/fixtures/payment_notified_challenge.json +24 -0
  20. package/template/base/connectors/midtrans/fixtures/payment_notified_expire.json +24 -0
  21. package/template/base/connectors/midtrans/fixtures/payment_notified_other_amount.json +28 -0
  22. package/template/base/connectors/midtrans/fixtures/payment_notified_partial_refund.json +34 -0
  23. package/template/base/connectors/midtrans/fixtures/payment_notified_pending.json +31 -0
  24. package/template/base/connectors/midtrans/fixtures/payment_notified_refund.json +34 -0
  25. package/template/base/connectors/midtrans/fixtures/payment_notified_relabelled.json +28 -0
  26. package/template/base/connectors/midtrans/fixtures/payment_notified_va.json +32 -0
  27. package/template/base/connectors/midtrans/fixtures/signature_vector.txt +3 -0
  28. package/template/base/connectors/midtrans/mock/midtrans_mock.py +335 -0
  29. package/template/base/connectors/rangka_whatsapp/README.md +105 -0
  30. package/template/base/connectors/rangka_whatsapp/connector.rk +141 -0
  31. package/template/base/connectors/rangka_whatsapp/fixtures/expect.json +9 -0
  32. package/template/base/connectors/rangka_whatsapp/fixtures/message_received.json +1 -0
  33. package/template/base/connectors/rangka_whatsapp/fixtures/message_status.json +1 -0
  34. package/template/base/connectors/rangka_whatsapp/fixtures/message_status_refused.json +1 -0
  35. package/template/base/connectors/rangka_whatsapp/fixtures/opted_out.json +1 -0
  36. package/template/base/connectors/rangka_whatsapp/fixtures/send_template.json +1 -0
  37. package/template/base/connectors/rangka_whatsapp/fixtures/send_template_duplicate.json +1 -0
  38. package/template/base/connectors/rangka_whatsapp/fixtures/set_opt_out.json +1 -0
  39. package/template/base/connectors/rangka_whatsapp/mock/rangka_whatsapp_mock.py +354 -0
  40. package/template/base/connectors/shopee/connector.rk +360 -0
  41. package/template/base/connectors/shopee/fixtures/expect.json +119 -0
  42. package/template/base/connectors/shopee/fixtures/get_models.json +52 -0
  43. package/template/base/connectors/shopee/fixtures/get_order_detail.json +396 -0
  44. package/template/base/connectors/shopee/fixtures/get_settlement.json +90 -0
  45. package/template/base/connectors/shopee/fixtures/get_tracking.json +13 -0
  46. package/template/base/connectors/shopee/fixtures/list_items.json +29 -0
  47. package/template/base/connectors/shopee/fixtures/list_orders.json +31 -0
  48. package/template/base/connectors/shopee/fixtures/list_settlements.json +15 -0
  49. package/template/base/connectors/shopee/fixtures/order_changed.json +101 -0
  50. package/template/base/connectors/shopee/fixtures/order_changed_cancelled.json +72 -0
  51. package/template/base/connectors/shopee/fixtures/order_changed_completed.json +101 -0
  52. package/template/base/connectors/shopee/fixtures/order_changed_in_cancel.json +72 -0
  53. package/template/base/connectors/shopee/fixtures/order_changed_unpaid.json +71 -0
  54. package/template/base/connectors/shopee/fixtures/order_settled.json +92 -0
  55. package/template/base/connectors/shopee/fixtures/push_received.json +12 -0
  56. package/template/base/connectors/shopee/fixtures/push_received_tracking.json +11 -0
  57. package/template/base/connectors/shopee/fixtures/update_stock.json +15 -0
  58. package/template/base/connectors/shopee/mock/shopee_mock.py +894 -0
  59. package/template/base/connectors/tiktok_shop/connector.rk +300 -0
  60. package/template/base/connectors/tiktok_shop/fixtures/expect.json +105 -0
  61. package/template/base/connectors/tiktok_shop/fixtures/get_order_detail.json +136 -0
  62. package/template/base/connectors/tiktok_shop/fixtures/get_settlement.json +83 -0
  63. package/template/base/connectors/tiktok_shop/fixtures/get_tracking.json +28 -0
  64. package/template/base/connectors/tiktok_shop/fixtures/list_orders.json +242 -0
  65. package/template/base/connectors/tiktok_shop/fixtures/list_products.json +77 -0
  66. package/template/base/connectors/tiktok_shop/fixtures/list_settlements.json +22 -0
  67. package/template/base/connectors/tiktok_shop/fixtures/list_shops.json +17 -0
  68. package/template/base/connectors/tiktok_shop/fixtures/order_changed.json +129 -0
  69. package/template/base/connectors/tiktok_shop/fixtures/order_changed_cancelled.json +81 -0
  70. package/template/base/connectors/tiktok_shop/fixtures/order_changed_completed.json +106 -0
  71. package/template/base/connectors/tiktok_shop/fixtures/order_changed_on_hold.json +104 -0
  72. package/template/base/connectors/tiktok_shop/fixtures/order_changed_tokopedia.json +106 -0
  73. package/template/base/connectors/tiktok_shop/fixtures/order_changed_unpaid.json +79 -0
  74. package/template/base/connectors/tiktok_shop/fixtures/order_settled.json +73 -0
  75. package/template/base/connectors/tiktok_shop/fixtures/update_stock.json +6 -0
  76. package/template/base/connectors/tiktok_shop/fixtures/webhook_received.json +12 -0
  77. package/template/base/connectors/tiktok_shop/fixtures/webhook_received_cancellation.json +13 -0
  78. package/template/base/connectors/tiktok_shop/mock/tiktok_shop_mock.py +819 -0
  79. package/template/base/connectors/whatsapp_business/connector.rk +3 -1
  80. package/template/base/connectors/whatsapp_business/templates.md +13 -1
  81. package/template/base/modules/accounting/flows/gl_asset_disposal_post.rk +68 -0
  82. package/template/base/modules/accounting/flows/gl_asset_disposal_reverse.rk +194 -0
  83. package/template/base/modules/accounting/flows/gl_depreciation_run_post.rk +43 -0
  84. package/template/base/modules/accounting/flows/gl_depreciation_run_reverse.rk +36 -0
  85. package/template/base/modules/accounting/flows/gl_fixed_asset_post.rk +51 -0
  86. package/template/base/modules/accounting/flows/gl_fixed_asset_reverse.rk +194 -0
  87. package/template/base/modules/accounting/flows/gl_vendor_bill_post.rk +2 -2
  88. package/template/base/modules/accounting/models/gl_entry.rk +2 -0
  89. package/template/base/modules/accounting/module.rk +2 -2
  90. package/template/base/modules/attendance/flows/attendance_missing_digest.rk +30 -0
  91. package/template/base/modules/attendance/flows/attendance_period_on_cancel.rk +15 -0
  92. package/template/base/modules/attendance/flows/attendance_period_on_submit.rk +60 -0
  93. package/template/base/modules/attendance/flows/staff_attendance_cancel_guard.rk +14 -0
  94. package/template/base/modules/attendance/flows/staff_attendance_guard_created.rk +16 -0
  95. package/template/base/modules/attendance/flows/staff_attendance_guard_submitted.rk +37 -0
  96. package/template/base/modules/attendance/flows/staff_attendance_guard_updated.rk +14 -0
  97. package/template/base/modules/attendance/models/attendance_period.rk +62 -0
  98. package/template/base/modules/attendance/models/attendance_summary.rk +37 -0
  99. package/template/base/modules/attendance/models/staff_attendance.rk +281 -0
  100. package/template/base/modules/attendance/models/staff_attendance_guard.rk +50 -0
  101. package/template/base/modules/attendance/module.rk +18 -0
  102. package/template/base/modules/attendance/screens/absen_outlet.rk +22 -0
  103. package/template/base/modules/catalogue/models/item.rk +69 -0
  104. package/template/base/modules/catalogue/module.rk +1 -1
  105. package/template/base/modules/contacts/models/customer.rk +43 -19
  106. package/template/base/modules/contacts/module.rk +1 -1
  107. package/template/base/modules/coretax/module.rk +1 -1
  108. package/template/base/modules/coretax/print/coretax_faktur.rk +3 -2
  109. package/template/base/modules/coretax/print/coretax_faktur.xml +3 -1
  110. package/template/base/modules/coretax/print/rekap_ppn.html +9 -7
  111. package/template/base/modules/courses/flows/charge_invoice_on_submit.rk +15 -0
  112. package/template/base/modules/courses/module.rk +1 -1
  113. package/template/base/modules/courses/screens/absen_kelas.rk +1 -0
  114. package/template/base/modules/fixed_assets/flows/asset_disposal_on_cancel.rk +14 -0
  115. package/template/base/modules/fixed_assets/flows/asset_disposal_on_submit.rk +21 -0
  116. package/template/base/modules/fixed_assets/flows/asset_from_vendor_bill.rk +41 -0
  117. package/template/base/modules/fixed_assets/flows/depreciation_run_fill.rk +28 -0
  118. package/template/base/modules/fixed_assets/flows/depreciation_run_monthly.rk +36 -0
  119. package/template/base/modules/fixed_assets/flows/depreciation_run_on_cancel.rk +30 -0
  120. package/template/base/modules/fixed_assets/flows/depreciation_run_on_submit.rk +34 -0
  121. package/template/base/modules/fixed_assets/flows/fixed_asset_on_cancel.rk +24 -0
  122. package/template/base/modules/fixed_assets/flows/fixed_asset_on_submit.rk +69 -0
  123. package/template/base/modules/fixed_assets/flows/fixed_assets_setup.rk +29 -0
  124. package/template/base/modules/fixed_assets/flows/opening_balance_asset_guard.rk +15 -0
  125. package/template/base/modules/fixed_assets/flows/vendor_bill_asset_guard.rk +14 -0
  126. package/template/base/modules/fixed_assets/imports/asset_list.rk +22 -0
  127. package/template/base/modules/fixed_assets/models/asset_bill_line.rk +24 -0
  128. package/template/base/modules/fixed_assets/models/asset_book.rk +83 -0
  129. package/template/base/modules/fixed_assets/models/asset_category.rk +54 -0
  130. package/template/base/modules/fixed_assets/models/asset_disposal.rk +97 -0
  131. package/template/base/modules/fixed_assets/models/asset_guard.rk +90 -0
  132. package/template/base/modules/fixed_assets/models/depreciation_line.rk +13 -0
  133. package/template/base/modules/fixed_assets/models/depreciation_run.rk +65 -0
  134. package/template/base/modules/fixed_assets/models/fixed_asset.rk +165 -0
  135. package/template/base/modules/fixed_assets/models/fixed_asset_setting.rk +34 -0
  136. package/template/base/modules/fixed_assets/module.rk +30 -0
  137. package/template/base/modules/fixed_assets/print/fixed_asset_register.html +45 -0
  138. package/template/base/modules/fixed_assets/print/fixed_asset_register.rk +17 -0
  139. package/template/base/modules/invoicing/flows/invoice_due_digest.rk +45 -7
  140. package/template/base/modules/invoicing/models/sales_invoice_item.rk +4 -1
  141. package/template/base/modules/invoicing/module.rk +15 -2
  142. package/template/base/modules/kitchen/screens/dapur.rk +1 -0
  143. package/template/base/modules/outlets/models/outlet.rk +69 -0
  144. package/template/base/modules/outlets/module.rk +1 -1
  145. package/template/base/modules/payments/flows/payment_from_midtrans.rk +85 -0
  146. package/template/base/modules/payments/flows/payment_refund_from_midtrans.rk +22 -0
  147. package/template/base/modules/payments/models/payment.rk +2 -1
  148. package/template/base/modules/payments/module.rk +1 -1
  149. package/template/base/modules/payroll/flows/payroll_close_on_cancel.rk +8 -5
  150. package/template/base/modules/payroll/flows/payroll_close_on_submit.rk +8 -5
  151. package/template/base/modules/payroll/flows/payroll_reminder.rk +106 -0
  152. package/template/base/modules/payroll/flows/payroll_run_overlap_guard_created.rk +5 -3
  153. package/template/base/modules/payroll/flows/payroll_run_overlap_guard_updated.rk +5 -3
  154. package/template/base/modules/payroll/flows/payslip_from_recap.rk +1 -1
  155. package/template/base/modules/payroll/imports/payroll_profile_list.rk +27 -0
  156. package/template/base/modules/payroll/models/payroll_close.rk +10 -6
  157. package/template/base/modules/payroll/models/payroll_run.rk +64 -15
  158. package/template/base/modules/payroll/models/payslip.rk +48 -9
  159. package/template/base/modules/payroll/module.rk +22 -5
  160. package/template/base/modules/payroll/print/payslip.html +4 -1
  161. package/template/base/modules/pos/models/pos_sale.rk +136 -9
  162. package/template/base/modules/pos/models/pos_sale_item.rk +33 -1
  163. package/template/base/modules/pos/module.rk +5 -3
  164. package/template/base/modules/pos/print/pos_receipt.html +7 -3
  165. package/template/base/modules/pos/screens/kasir.rk +7 -2
  166. package/template/base/modules/procurement/flows/reorder_draft_po.rk +57 -0
  167. package/template/base/modules/procurement/models/vendor_bill.rk +21 -2
  168. package/template/base/modules/procurement/module.rk +11 -2
  169. package/template/base/modules/projects/screens/absen.rk +1 -0
  170. package/template/base/modules/promotions/flows/promo_code_batch_on_submit.rk +26 -0
  171. package/template/base/modules/promotions/flows/promotion_apply.rk +110 -0
  172. package/template/base/modules/promotions/flows/promotion_apply_on_create.rk +110 -0
  173. package/template/base/modules/promotions/flows/promotion_apply_on_delete.rk +111 -0
  174. package/template/base/modules/promotions/flows/promotion_apply_on_update.rk +110 -0
  175. package/template/base/modules/promotions/flows/promotion_on_sale.rk +95 -0
  176. package/template/base/modules/promotions/flows/promotion_on_sale_cancel.rk +43 -0
  177. package/template/base/modules/promotions/models/promo_code.rk +27 -0
  178. package/template/base/modules/promotions/models/promo_code_batch.rk +36 -0
  179. package/template/base/modules/promotions/models/promo_guard.rk +44 -0
  180. package/template/base/modules/promotions/models/promotion.rk +197 -0
  181. package/template/base/modules/promotions/models/promotion_ledger.rk +35 -0
  182. package/template/base/modules/promotions/module.rk +20 -0
  183. package/template/base/modules/rental/models/rental_unit.rk +13 -3
  184. package/template/base/modules/rental/module.rk +2 -2
  185. package/template/base/modules/rental/screens/alat_keluar.rk +1 -0
  186. package/template/base/modules/rental/screens/alat_kembali.rk +1 -0
  187. package/template/base/modules/rental/screens/jadwal_alat.rk +1 -0
  188. package/template/base/modules/stock/flows/stock_low_alert.rk +65 -0
  189. package/template/base/modules/stock/flows/stock_negative_alert.rk +14 -5
  190. package/template/base/modules/stock/models/stock_reorder.rk +34 -0
  191. package/template/base/modules/stock/module.rk +17 -2
  192. package/template/base/modules/subscriptions/screens/catat_tagih.rk +1 -0
  193. package/template/base/modules/subscriptions/screens/rute_tagih.rk +1 -0
  194. package/template/base/modules/users/flows/summary_daily.rk +83 -0
  195. package/template/base/modules/users/flows/summary_monthly.rk +83 -0
  196. package/template/base/modules/users/flows/summary_weekly.rk +83 -0
  197. package/template/base/modules/users/models/business_summary.rk +67 -0
  198. package/template/base/modules/users/models/summary_setting.rk +35 -0
  199. package/template/base/modules/users/models/user.rk +11 -3
  200. package/template/base/modules/users/module.rk +21 -2
  201. package/template/base/modules/users/roles/employee.rk +8 -0
  202. package/template/base/modules/users/roles/outlet_supervisor.rk +7 -0
  203. package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out.rk +16 -0
  204. package/template/base/modules/whatsapp/flows/whatsapp_customer_opt_out_new.rk +17 -0
  205. package/template/base/modules/whatsapp/flows/whatsapp_message_status.rk +24 -0
  206. package/template/base/modules/whatsapp/flows/whatsapp_opted_out.rk +26 -0
  207. package/template/base/modules/whatsapp/models/whatsapp_message.rk +99 -0
  208. package/template/base/modules/whatsapp/models/whatsapp_opt_out.rk +44 -0
  209. package/template/base/modules/whatsapp/module.rk +23 -0
  210. package/template/base/modules/whatsapp_booking/flows/whatsapp_booking_tomorrow.rk +48 -0
  211. package/template/base/modules/whatsapp_booking/module.rk +13 -0
  212. package/template/base/modules/whatsapp_order_ready/flows/whatsapp_pickup_on_sale.rk +19 -0
  213. package/template/base/modules/whatsapp_order_ready/flows/whatsapp_ticket_ready.rk +40 -0
  214. package/template/base/modules/whatsapp_order_ready/models/whatsapp_pickup.rk +22 -0
  215. package/template/base/modules/whatsapp_order_ready/module.rk +14 -0
  216. package/template/base/modules/whatsapp_receipt/flows/whatsapp_receipt_on_sale.rk +43 -0
  217. package/template/base/modules/whatsapp_receipt/module.rk +13 -0
  218. package/template/base/modules/whatsapp_reminder/flows/whatsapp_invoice_overdue.rk +64 -0
  219. package/template/base/modules/whatsapp_reminder/module.rk +15 -0
  220. package/template/base/modules/workforce/imports/worker_list.rk +4 -1
@@ -0,0 +1,34 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Inside a monthly depreciation run's submit: refused when a run for this month or a later one is already submitted, or
3
+ # when a line no longer matches its asset (the asset was cancelled, disposed of or depreciated by another run since
4
+ # the draft was made, or its amount, outlet or project was changed): delete the draft and make it again. Then each register row takes its
5
+ # line: accumulated depreciation, the month depreciated, the run, and Habis disusutkan once the book value reaches the
6
+ # residual. The journal is the accounting module's (gl_depreciation_run_post).
7
+ name: depreciation_run_on_submit
8
+ label: {id: Penyusutan bulanan masuk daftar aset}
9
+ on: depreciation_run.submitted
10
+ if: "'docstatus' in event && event.docstatus == 1"
11
+ steps:
12
+ - find: depreciation_run
13
+ where: name != event.name && docstatus == 1 && period >= event.period
14
+ as: later
15
+ - if: later != null
16
+ create: asset_guard
17
+ set: {reason: "'run_exists'", document: later.name}
18
+ - find_all: asset_book
19
+ where: asset in event.lines.map(l, l.asset) && state != 'cancelled'
20
+ as: books
21
+ - if: >-
22
+ books.size() != event.lines.size() || !event.lines.all(l, books.exists(b, b.asset == l.asset
23
+ && b.state == 'active' && (b.depreciated_through == '' ? string(b.depreciation_start) : add_months(string(b.depreciated_through), 1)) <= string(event.period) && (b.book_value - b.residual_value) > 0 && b.depreciated_through == l.prev_through && l.outlet == b.outlet && l.project == b.project && l.amount == (2 * ((b.book_value - b.residual_value) - b.monthly_depreciation * (int((double(days_between((b.depreciated_through == '' ? string(b.depreciation_start) : add_months(string(b.depreciated_through), 1)), string(event.period))) + 15.0) / 30.436875) + 1)) < b.monthly_depreciation ? (b.book_value - b.residual_value) : b.monthly_depreciation * (int((double(days_between((b.depreciated_through == '' ? string(b.depreciation_start) : add_months(string(b.depreciated_through), 1)), string(event.period))) + 15.0) / 30.436875) + 1))))
24
+ create: asset_guard
25
+ set: {reason: "'run_stale'", document: event.name}
26
+ - for_each: books
27
+ as: b
28
+ do:
29
+ - update: b
30
+ set:
31
+ accumulated: b.accumulated + event.lines.filter(l, l.asset == b.asset)[0].amount
32
+ depreciated_through: event.period
33
+ last_run: event.name
34
+ state: "b.book_value - event.lines.filter(l, l.asset == b.asset)[0].amount <= b.residual_value ? 'fully_depreciated' : 'active'"
@@ -0,0 +1,24 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Inside a fixed asset's cancel: refused once a run has depreciated it or it was sold or written off (cancel those
3
+ # first, latest first). Otherwise its register row is closed (state cancelled, kept as history) and the rental unit
4
+ # no longer points at it. The purchase journal is reversed by the accounting module.
5
+ name: fixed_asset_on_cancel
6
+ label: {id: Aset tetap batal}
7
+ on: fixed_asset.cancelled
8
+ steps:
9
+ - find: asset_book
10
+ where: asset == event.name
11
+ as: b
12
+ - if: "b != null && (b.accumulated > 0 || b.state in ['sold', 'written_off'])"
13
+ create: asset_guard
14
+ set: {reason: "'asset_in_use'", document: b.name}
15
+ - update: b
16
+ if: b != null
17
+ set: {state: "'cancelled'"}
18
+ - find: rental_unit
19
+ if: event.rental_unit != ''
20
+ where: name == event.rental_unit && asset == event.name
21
+ as: u
22
+ - update: u
23
+ if: event.rental_unit != '' && u != null
24
+ set: {asset: "''"}
@@ -0,0 +1,69 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Inside a fixed asset's submit: refuses an asset below the capitalisation threshold (fixed_asset_setting; 0 = no
3
+ # threshold; Rp 1.000.000 until the setting exists, e.g. in an org the daily setup flow does not reach), an asset from a
4
+ # bill whose cost is not the cost the bill's flow recorded for its line (asset_bill_line, audit F1) or whose line is
5
+ # already another live asset, an old asset while Saldo awal already carries fixed assets as one number (audit F5), or a
6
+ # rental unit that is already another live asset;
7
+ # then opens its row in the register (asset_book, the values the runs and disposals move) and links the rental unit
8
+ # back to it. Reads in the order fixed_asset_setting, fixed_asset, asset_book, rental_unit (contract 0025).
9
+ name: fixed_asset_on_submit
10
+ label: {id: Aset tetap masuk daftar aset}
11
+ on: fixed_asset.submitted
12
+ if: "'docstatus' in event && event.docstatus == 1"
13
+ steps:
14
+ - {find: fixed_asset_setting, as: cfg}
15
+ - if: "event.cost < (cfg != null ? cfg.capitalisation_threshold : 1000000)"
16
+ create: asset_guard
17
+ set: {reason: "'below_threshold'", document: event.name}
18
+ - find: asset_bill_line
19
+ if: event.source == 'vendor_bill'
20
+ where: vendor_bill == event.vendor_bill && bill_line == event.bill_line
21
+ as: bl
22
+ - if: "event.source == 'vendor_bill' && (bl == null || bl.cost != event.cost)"
23
+ create: asset_guard
24
+ set: {reason: "'bill_cost'", document: event.vendor_bill}
25
+ - find: fixed_asset
26
+ if: event.source == 'vendor_bill'
27
+ where: name != event.name && docstatus == 1 && vendor_bill == event.vendor_bill && bill_line == event.bill_line
28
+ as: twin
29
+ - if: event.source == 'vendor_bill' && twin != null
30
+ create: asset_guard
31
+ set: {reason: "'bill_line_taken'", document: twin.name}
32
+ - find: opening_balance
33
+ if: event.source == 'opening'
34
+ where: docstatus == 1 && (fixed_assets != 0 || accumulated_depreciation != 0)
35
+ as: ob
36
+ - if: event.source == 'opening' && ob != null
37
+ create: asset_guard
38
+ set: {reason: "'opening_twice'", document: ob.name}
39
+ - find: asset_book
40
+ if: event.rental_unit != ''
41
+ where: rental_unit == event.rental_unit && state != 'cancelled'
42
+ as: other
43
+ - if: event.rental_unit != '' && other != null
44
+ create: asset_guard
45
+ set: {reason: "'unit_taken'", document: other.asset}
46
+ - create: asset_book
47
+ set:
48
+ asset: event.name
49
+ asset_name: event.asset_name
50
+ category: event.category
51
+ outlet: event.outlet
52
+ project: event.project
53
+ rental_unit: event.rental_unit
54
+ acquisition_date: event.acquisition_date
55
+ cost: event.cost
56
+ residual_value: event.residual_value
57
+ monthly_depreciation: event.monthly_depreciation
58
+ depreciation_start: event.depreciation_start
59
+ opening_accumulated: event.opening_accumulated
60
+ accumulated: '0'
61
+ # an old asset brought in already fully depreciated is not depreciated again (audit F7)
62
+ state: "event.cost - event.opening_accumulated <= event.residual_value ? 'fully_depreciated' : 'active'"
63
+ - find: rental_unit
64
+ if: event.rental_unit != ''
65
+ where: name == event.rental_unit
66
+ as: u
67
+ - update: u
68
+ if: event.rental_unit != '' && u != null
69
+ set: {asset: event.name}
@@ -0,0 +1,29 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Makes the one fixed_asset_setting record (capitalisation threshold Rp 1.000.000) and, when there is no category yet,
3
+ # the six default categories (useful life in months and fiscal group of PMK 72/2023). Every morning at 05:00, so a
4
+ # business that adds the module has them the next day; finance or the owner can also run it from the flow list right
5
+ # away. It never changes a record that exists. Scheduled flows run for the default org only (contract 0031).
6
+ name: fixed_assets_setup
7
+ label: {id: Siapkan aset tetap, en: Set up fixed assets}
8
+ description: {id: 'Membuat pengaturan aset tetap dan enam kelompok aset bawaan bila belum ada.'}
9
+ schedule: '0 5 * * *'
10
+ steps:
11
+ - {find: fixed_asset_setting, as: cfg}
12
+ - create: fixed_asset_setting
13
+ if: cfg == null
14
+ set: {key: "'usaha'", capitalisation_threshold: '1000000'}
15
+ - find_all: asset_category
16
+ limit: 1
17
+ as: cats
18
+ - for_each: >-
19
+ cats.size() > 0 ? [] : [
20
+ {'n': 'Kendaraan', 'm': 96, 'g': 'kelompok_2'},
21
+ {'n': 'Peralatan kantor', 'm': 48, 'g': 'kelompok_1'},
22
+ {'n': 'Komputer dan HP', 'm': 48, 'g': 'kelompok_1'},
23
+ {'n': 'Mesin', 'm': 96, 'g': 'kelompok_2'},
24
+ {'n': 'Alat sewa', 'm': 48, 'g': 'kelompok_1'},
25
+ {'n': 'Bangunan', 'm': 240, 'g': 'bangunan_permanen'}]
26
+ as: c
27
+ do:
28
+ - create: asset_category
29
+ set: {category_name: c.n, useful_life_months: c.m, residual_percent: '0', fiscal_group: c.g}
@@ -0,0 +1,15 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Inside a Saldo awal's submit (module accounting): refused when it carries fixed assets or their depreciation while
3
+ # old assets were already brought in one by one (fixed_asset source opening), which post the same 1-2100, 1-2900 and
4
+ # 3-1900 (audit F5). One way only: the per-asset register or the one number.
5
+ name: opening_balance_asset_guard
6
+ label: {id: Saldo awal tidak memuat aset lama dua kali}
7
+ on: opening_balance.submitted
8
+ if: "'docstatus' in event && event.docstatus == 1 && (event.fixed_assets != 0 || event.accumulated_depreciation != 0)"
9
+ steps:
10
+ - find: fixed_asset
11
+ where: docstatus == 1 && source == 'opening'
12
+ as: fa
13
+ - if: fa != null
14
+ create: asset_guard
15
+ set: {reason: "'opening_twice'", document: fa.name}
@@ -0,0 +1,14 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Inside a vendor bill's cancel: refused while a submitted fixed asset was made from it (its cost is the bill's 1-2100
3
+ # debit). Cancel the assets first. Drafts made from the bill stay as drafts and can no longer be submitted (rule
4
+ # bill_source: the bill must be submitted); delete them.
5
+ name: vendor_bill_asset_guard
6
+ label: {id: Tagihan yang sudah jadi aset tidak bisa dibatalkan}
7
+ on: vendor_bill.cancelled
8
+ steps:
9
+ - find: fixed_asset
10
+ where: vendor_bill == event.name && docstatus == 1
11
+ as: fa
12
+ - if: fa != null
13
+ create: asset_guard
14
+ set: {reason: "'bill_has_asset'", document: fa.name}
@@ -0,0 +1,22 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
2
+ # Daftar aset lama from a spreadsheet: one row per asset the business already had before its books started in Rangka.
3
+ # Headers: Nama aset, Kelompok (the category name), Tanggal beli, Tanggal saldo awal, Harga perolehan, Akumulasi
4
+ # penyusutan, Umur manfaat (bulan), Nomor seri. Each row arrives as a draft fixed asset with source "Aset lama":
5
+ # check it (outlet, rental unit), then submit it to post (cost against the depreciation it had and Ekuitas saldo
6
+ # awal). Sample: examples/fixtures/imports/asset-list.csv.
7
+ name: asset_list
8
+ label: {id: Daftar aset lama, en: Opening asset list}
9
+ model: fixed_asset
10
+ source: csv
11
+ header_row: 1
12
+ key: [Nama aset, Tanggal beli, Nomor seri]
13
+ map:
14
+ asset_name: Nama aset
15
+ source: "='opening'"
16
+ category: {value: Kelompok, match: category_name}
17
+ acquisition_date: Tanggal beli
18
+ book_date: Tanggal saldo awal
19
+ cost: Harga perolehan
20
+ opening_accumulated: Akumulasi penyusutan
21
+ useful_life_months: Umur manfaat (bulan)
22
+ serial_no: Nomor seri
@@ -0,0 +1,24 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # The cost each line of a vendor bill posted as "Aset tetap" put in 1-2100 (the line, plus its share of PPN when the
3
+ # business is not PKP), written by flow asset_from_vendor_bill only (every field read_only: a client cannot create or
4
+ # change one). A fixed asset from a bill is submitted only at exactly this cost and only once per line (flow
5
+ # fixed_asset_on_submit), so the register can never hold more or less than the bill debited.
6
+ name: asset_bill_line
7
+ label: {id: Baris tagihan aset, en: Asset bill line}
8
+ icon: file-list-line
9
+ naming: ABL-{######}
10
+ title_field: bill_line_key
11
+ permissions:
12
+ # the bill's flow runs as the person who submits it; the asset's submit (finance, head office) reads the line
13
+ - {role: purchasing_manager, read: true, create: true}
14
+ - {role: finance_manager, read: true, create: true}
15
+ - {role: head_office, read: true, create: true}
16
+ fields:
17
+ - {name: vendor_bill, type: link, to: vendor_bill, label: {id: Tagihan pemasok}, required: true, read_only: true}
18
+ - {name: bill_line, type: int, label: {id: Baris tagihan}, required: true, read_only: true}
19
+ - {name: cost, type: currency, label: {id: Nilai aset baris ini}, required: true, read_only: true}
20
+ - {name: bill_line_key, type: data, label: {id: Kunci baris}, unique: true, compute: "vendor_bill + ':' + string(bill_line)"}
21
+ views:
22
+ list:
23
+ columns: [vendor_bill, bill_line, cost]
24
+ sort: vendor_bill
@@ -0,0 +1,83 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # Buku aset: one row per submitted fixed asset, made and kept current by the flows of this module (a submitted document
3
+ # cannot change, the pattern of rental_schedule): what the asset cost, how much has been depreciated, up to which
4
+ # month, and whether it is still in use, fully depreciated, sold or written off. The depreciation runs read and write
5
+ # these rows; a disposal picks one. Every field is read_only: only the flows write them. This is the register a person
6
+ # reads ("Daftar aset tetap"): book value = cost - depreciation before the books started - depreciation since.
7
+ name: asset_book
8
+ label: {id: Daftar aset tetap, en: Fixed asset register}
9
+ icon: building-2-line
10
+ naming: '{asset}-{##}'
11
+ title_field: asset_name
12
+ permissions:
13
+ # write: the runs and disposals of whoever submits or cancels them update the row (its fields are read_only)
14
+ - {role: finance_manager, read: true, create: true, write: true, export: true, print: true}
15
+ - {role: head_office, read: true, create: true, write: true, export: true, print: true}
16
+ - {role: rental_staff, read: true}
17
+ fields:
18
+ - {name: asset, type: link, to: fixed_asset, label: {id: Aset}, required: true, unique: true, read_only: true, in_list: true}
19
+ - {name: asset_name, type: data, label: {id: Nama aset}, read_only: true, in_list: true}
20
+ - {name: category, type: link, to: asset_category, label: {id: Kelompok aset}, read_only: true, in_list: true}
21
+ - {name: outlet, type: link, to: outlet, label: {id: Cabang}, read_only: true, in_list: true, depends_on: app_installed('outlets')}
22
+ - {name: project, type: link, to: project, label: {id: Proyek}, read_only: true, depends_on: app_installed('projects')}
23
+ - {name: rental_unit, type: link, to: rental_unit, label: {id: Unit alat sewa}, read_only: true, depends_on: app_installed('rental')}
24
+ - {name: acquisition_date, type: date, label: {id: Tanggal beli}, read_only: true}
25
+ - {name: cost, type: currency, label: {id: Harga perolehan}, read_only: true, in_list: true, hidden_for: [rental_staff]}
26
+ - {name: residual_value, type: currency, label: {id: Nilai sisa}, read_only: true, hidden_for: [rental_staff]}
27
+ - {name: monthly_depreciation, type: currency, label: {id: Penyusutan per bulan}, read_only: true, hidden_for: [rental_staff]}
28
+ - {name: depreciation_start, type: date, label: {id: Mulai disusutkan}, read_only: true}
29
+ - {name: opening_accumulated, type: currency, label: {id: Akumulasi sebelum pembukuan}, read_only: true, hidden_for: [rental_staff]}
30
+ - {name: accumulated, type: currency, label: {id: Akumulasi penyusutan}, read_only: true, hidden_for: [rental_staff]}
31
+ - name: accumulated_total
32
+ type: currency
33
+ label: {id: Total akumulasi penyusutan}
34
+ compute: opening_accumulated + accumulated
35
+ hidden_for: [rental_staff]
36
+ - name: book_value
37
+ type: currency
38
+ label: {id: Nilai buku}
39
+ compute: cost - opening_accumulated - accumulated
40
+ in_list: true
41
+ hidden_for: [rental_staff]
42
+ - name: depreciated_through
43
+ type: date
44
+ label: {id: Disusutkan sampai bulan}
45
+ help: {id: 'Tanggal 1 bulan terakhir yang sudah disusutkan'}
46
+ read_only: true
47
+ - {name: last_run, type: link, to: depreciation_run, label: {id: Penyusutan terakhir}, read_only: true}
48
+ - name: state
49
+ type: select
50
+ label: {id: Status}
51
+ default: "'active'"
52
+ read_only: true
53
+ in_list: true
54
+ chip: true
55
+ options:
56
+ - {value: active, label: {id: Aktif}}
57
+ - {value: fully_depreciated, label: {id: Habis disusutkan}}
58
+ - {value: sold, label: {id: Dijual}}
59
+ - {value: written_off, label: {id: Dihapus}}
60
+ - {value: cancelled, label: {id: Batal}}
61
+ - {name: disposal, type: link, to: asset_disposal, label: {id: Pelepasan}, read_only: true}
62
+ # words for the register print (a print reads option labels of its own model only)
63
+ - {name: category_name, type: data, label: {id: Nama kelompok}, hidden: true, compute: category.category_name}
64
+ - name: state_label
65
+ type: data
66
+ label: {id: Status (teks)}
67
+ hidden: true
68
+ compute: "state == 'active' ? 'Aktif' : (state == 'fully_depreciated' ? 'Habis disusutkan' : (state == 'sold' ? 'Dijual' : (state == 'written_off' ? 'Dihapus' : 'Batal')))"
69
+ views:
70
+ list:
71
+ columns: [asset, category, outlet, book_value, cost, accumulated_total, state]
72
+ filters: [category, outlet, state]
73
+ sort: asset
74
+ form:
75
+ layout:
76
+ - section: {id: Aset}
77
+ columns:
78
+ - [asset, asset_name, category, outlet, project, rental_unit]
79
+ - [acquisition_date, state, disposal]
80
+ - section: {id: Penyusutan}
81
+ columns:
82
+ - [cost, residual_value, monthly_depreciation, depreciation_start]
83
+ - [opening_accumulated, accumulated, accumulated_total, book_value, depreciated_through, last_run]
@@ -0,0 +1,54 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # Kelompok aset: the defaults a new asset takes (useful life in months, residual value as a percent of the cost) and
3
+ # its fiscal group under PMK 72/2023 (useful life for tax: kelompok 1 four years, 2 eight, 3 sixteen, 4 twenty;
4
+ # permanent buildings twenty, non-permanent ten). The fiscal group is stored for a later Coretax report; v1 books the
5
+ # commercial straight line only. Six defaults are made by flow fixed_assets_setup.
6
+ name: asset_category
7
+ label: {id: Kelompok aset, en: Asset category}
8
+ icon: folder-2-line
9
+ naming: AKL-{###}
10
+ title_field: category_name
11
+ permissions:
12
+ - {role: finance_manager, read: true, create: true, write: true, delete: true, export: true}
13
+ - {role: head_office, read: true, create: true, write: true, delete: true, export: true}
14
+ - {role: purchasing_manager, read: true}
15
+ - {role: rental_staff, read: true}
16
+ fields:
17
+ - {name: category_name, type: data, label: {id: Nama kelompok}, required: true, unique: true, in_list: true}
18
+ - name: useful_life_months
19
+ type: int
20
+ label: {id: Umur manfaat (bulan)}
21
+ help: {id: 'Berapa bulan aset dipakai sampai habis disusutkan, misalnya 48 untuk 4 tahun'}
22
+ required: true
23
+ in_list: true
24
+ - name: residual_percent
25
+ type: percent
26
+ label: {id: Nilai sisa (% harga)}
27
+ help: {id: 'Perkiraan nilai jual di akhir umur manfaat, persen dari harga perolehan. Biasanya 0'}
28
+ default: '0'
29
+ in_list: true
30
+ - name: fiscal_group
31
+ type: select
32
+ label: {id: Kelompok fiskal (PMK 72/2023)}
33
+ help: {id: 'Untuk laporan pajak nanti. Belum mengubah penyusutan di pembukuan'}
34
+ in_list: true
35
+ options:
36
+ - {value: kelompok_1, label: {id: Kelompok 1 (4 tahun)}}
37
+ - {value: kelompok_2, label: {id: Kelompok 2 (8 tahun)}}
38
+ - {value: kelompok_3, label: {id: Kelompok 3 (16 tahun)}}
39
+ - {value: kelompok_4, label: {id: Kelompok 4 (20 tahun)}}
40
+ - {value: bangunan_permanen, label: {id: Bangunan permanen (20 tahun)}}
41
+ - {value: bangunan_tidak_permanen, label: {id: Bangunan tidak permanen (10 tahun)}}
42
+ rules:
43
+ - name: life_positive
44
+ on: save
45
+ check: useful_life_months > 0 && useful_life_months <= 600
46
+ message: {id: Umur manfaat antara 1 dan 600 bulan}
47
+ - name: residual_range
48
+ on: save
49
+ check: residual_percent >= 0 && residual_percent < 100
50
+ message: {id: Nilai sisa antara 0 dan kurang dari 100 persen}
51
+ views:
52
+ list:
53
+ columns: [category_name, useful_life_months, residual_percent, fiscal_group]
54
+ sort: category_name
@@ -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]