@rangka-os/create 0.0.0-stage → 0.5.0-alpha.2

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 (122) hide show
  1. package/index.js +101 -0
  2. package/package.json +29 -4
  3. package/template/base/README.md +32 -0
  4. package/template/base/_gitignore +3 -0
  5. package/template/base/_vscode/settings.json +4 -0
  6. package/template/base/apps/crm/app.rk +42 -0
  7. package/template/base/apps/crm/dashboards/crm_overview.rk +88 -0
  8. package/template/base/apps/crm/dashboards/sales_overview.rk +66 -0
  9. package/template/base/apps/fnb_cabang/app.rk +41 -0
  10. package/template/base/apps/fnb_cabang/dashboards/fnb_overview.rk +80 -0
  11. package/template/base/apps/fnb_cabang/dashboards/stock_recap.rk +129 -0
  12. package/template/base/apps/jasa_proyek/app.rk +49 -0
  13. package/template/base/apps/jasa_proyek/dashboards/ar_aging.rk +88 -0
  14. package/template/base/apps/jasa_proyek/dashboards/jasa_overview.rk +121 -0
  15. package/template/base/connectors/whatsapp_business/connector.rk +68 -0
  16. package/template/base/docker-compose.yml +16 -0
  17. package/template/base/env.example +12 -0
  18. package/template/base/modules/catalogue/models/item.rk +60 -0
  19. package/template/base/modules/catalogue/models/price_list.rk +34 -0
  20. package/template/base/modules/catalogue/models/price_list_item.rk +21 -0
  21. package/template/base/modules/catalogue/models/uom.rk +20 -0
  22. package/template/base/modules/catalogue/models/uom_conversion.rk +36 -0
  23. package/template/base/modules/catalogue/module.rk +5 -0
  24. package/template/base/modules/contacts/models/contact_person.rk +21 -0
  25. package/template/base/modules/contacts/models/customer.rk +72 -0
  26. package/template/base/modules/contacts/models/vendor.rk +71 -0
  27. package/template/base/modules/contacts/module.rk +5 -0
  28. package/template/base/modules/currency/models/currency.rk +34 -0
  29. package/template/base/modules/currency/models/exchange_rate.rk +39 -0
  30. package/template/base/modules/currency/module.rk +5 -0
  31. package/template/base/modules/invoicing/models/sales_invoice.rk +290 -0
  32. package/template/base/modules/invoicing/models/sales_invoice_item.rk +37 -0
  33. package/template/base/modules/invoicing/module.rk +9 -0
  34. package/template/base/modules/invoicing/print/sales_invoice.html +63 -0
  35. package/template/base/modules/invoicing/print/sales_invoice.rk +7 -0
  36. package/template/base/modules/orders/models/customer_order.rk +100 -0
  37. package/template/base/modules/orders/models/customer_order_item.rk +30 -0
  38. package/template/base/modules/orders/module.rk +9 -0
  39. package/template/base/modules/outlet_sales/imports/daily_form.rk +20 -0
  40. package/template/base/modules/outlet_sales/imports/moka_item_details.rk +24 -0
  41. package/template/base/modules/outlet_sales/models/outlet_sales.rk +106 -0
  42. package/template/base/modules/outlet_sales/models/outlet_sales_line.rk +39 -0
  43. package/template/base/modules/outlet_sales/module.rk +7 -0
  44. package/template/base/modules/outlets/models/outlet.rk +39 -0
  45. package/template/base/modules/outlets/module.rk +5 -0
  46. package/template/base/modules/payments/models/payment.rk +154 -0
  47. package/template/base/modules/payments/models/payment_allocation.rk +35 -0
  48. package/template/base/modules/payments/models/withholding.rk +62 -0
  49. package/template/base/modules/payments/module.rk +8 -0
  50. package/template/base/modules/payments/print/statement.html +55 -0
  51. package/template/base/modules/payments/print/statement.rk +13 -0
  52. package/template/base/modules/pipeline/flows/morning_follow_up.rk +10 -0
  53. package/template/base/modules/pipeline/flows/whatsapp_to_lead.rk +24 -0
  54. package/template/base/modules/pipeline/models/activity.rk +83 -0
  55. package/template/base/modules/pipeline/models/deal.rk +139 -0
  56. package/template/base/modules/pipeline/models/lead.rk +119 -0
  57. package/template/base/modules/pipeline/module.rk +7 -0
  58. package/template/base/modules/procurement/models/goods_receipt.rk +85 -0
  59. package/template/base/modules/procurement/models/goods_receipt_item.rk +42 -0
  60. package/template/base/modules/procurement/models/purchase_order.rk +148 -0
  61. package/template/base/modules/procurement/models/purchase_order_item.rk +46 -0
  62. package/template/base/modules/procurement/models/purchase_request.rk +81 -0
  63. package/template/base/modules/procurement/models/purchase_request_item.rk +35 -0
  64. package/template/base/modules/procurement/models/vendor_bill.rk +166 -0
  65. package/template/base/modules/procurement/models/vendor_bill_item.rk +33 -0
  66. package/template/base/modules/procurement/module.rk +9 -0
  67. package/template/base/modules/procurement/print/purchase_order.html +120 -0
  68. package/template/base/modules/procurement/print/purchase_order.rk +7 -0
  69. package/template/base/modules/projects/models/acceptance.rk +68 -0
  70. package/template/base/modules/projects/models/assignment.rk +63 -0
  71. package/template/base/modules/projects/models/project.rk +81 -0
  72. package/template/base/modules/projects/models/timesheet.rk +82 -0
  73. package/template/base/modules/projects/module.rk +6 -0
  74. package/template/base/modules/quotation/models/quotation.rk +201 -0
  75. package/template/base/modules/quotation/models/quotation_item.rk +37 -0
  76. package/template/base/modules/quotation/module.rk +9 -0
  77. package/template/base/modules/quotation/print/quotation.html +65 -0
  78. package/template/base/modules/quotation/print/quotation.rk +7 -0
  79. package/template/base/modules/stock/flows/stock_negative_alert.rk +15 -0
  80. package/template/base/modules/stock/models/recipe.rk +60 -0
  81. package/template/base/modules/stock/models/recipe_line.rk +24 -0
  82. package/template/base/modules/stock/models/stock_adjustment.rk +61 -0
  83. package/template/base/modules/stock/models/stock_adjustment_item.rk +32 -0
  84. package/template/base/modules/stock/models/stock_balance.rk +23 -0
  85. package/template/base/modules/stock/models/stock_count.rk +54 -0
  86. package/template/base/modules/stock/models/stock_count_item.rk +33 -0
  87. package/template/base/modules/stock/models/stock_move.rk +41 -0
  88. package/template/base/modules/stock/models/stock_transfer.rk +70 -0
  89. package/template/base/modules/stock/models/stock_transfer_item.rk +34 -0
  90. package/template/base/modules/stock/models/stock_transfer_receipt.rk +57 -0
  91. package/template/base/modules/stock/models/stock_transfer_receipt_item.rk +18 -0
  92. package/template/base/modules/stock/module.rk +8 -0
  93. package/template/base/modules/tax_id/models/tax_code.rk +49 -0
  94. package/template/base/modules/tax_id/module.rk +5 -0
  95. package/template/base/modules/users/models/user.rk +27 -0
  96. package/template/base/modules/users/module.rk +5 -0
  97. package/template/base/modules/users/roles/finance_manager.rk +4 -0
  98. package/template/base/modules/users/roles/head_office.rk +4 -0
  99. package/template/base/modules/users/roles/outlet_staff.rk +6 -0
  100. package/template/base/modules/users/roles/project_admin.rk +4 -0
  101. package/template/base/modules/users/roles/purchasing_manager.rk +4 -0
  102. package/template/base/modules/users/roles/sales_manager.rk +4 -0
  103. package/template/base/modules/users/roles/sales_rep.rk +4 -0
  104. package/template/base/modules/workforce/models/certification.rk +26 -0
  105. package/template/base/modules/workforce/models/worker.rk +53 -0
  106. package/template/base/modules/workforce/module.rk +5 -0
  107. package/template/base/package.json +17 -0
  108. package/template/blank/fixtures/start.rk +5 -0
  109. package/template/blank/site/config.rk +13 -0
  110. package/template/blank/site/custom/README.md +2 -0
  111. package/template/blank/site/features.rk +13 -0
  112. package/template/blank/site/layouts/main.rk +14 -0
  113. package/template/blank/site/system.rk +20 -0
  114. package/template/blank/site/themes/main.rk +8 -0
  115. package/template/demo/fixtures/crm_demo.rk +168 -0
  116. package/template/demo/fixtures/demo.rk +417 -0
  117. package/template/demo/site/config.rk +13 -0
  118. package/template/demo/site/features.rk +13 -0
  119. package/template/demo/site/layouts/crm_first.rk +23 -0
  120. package/template/demo/site/system.rk +26 -0
  121. package/template/demo/site/themes/kopi_senja.rk +10 -0
  122. package/README.md +0 -3
@@ -0,0 +1,34 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: currency
3
+ label: {id: Mata uang}
4
+ icon: card
5
+ # Named by ISO code (ruling): naming has no field source in schema 0.5 (contract 0009), so fixtures set name = code (IDR, USD)
6
+ # and documents' `currency` holds the code; a currency added in the UI gets CUR-nnn until the kernel can name from a field.
7
+ naming: CUR-{###}
8
+ title_field: code
9
+ permissions:
10
+ - {role: sales_manager, read: true, create: true, write: true, print: true}
11
+ - {role: finance_manager, read: true, create: true, write: true, print: true}
12
+ - {role: purchasing_manager, read: true, create: true, write: true, print: true}
13
+ - {role: project_admin, read: true, create: true, write: true, print: true}
14
+ - {role: head_office, read: true, create: true, write: true, print: true}
15
+ - {role: outlet_staff, read: true}
16
+ fields:
17
+ - name: code
18
+ type: data
19
+ label: {id: Kode ISO}
20
+ required: true
21
+ unique: true
22
+ in_list: true
23
+ - name: currency_name
24
+ type: data
25
+ label: {id: Nama}
26
+ in_list: true
27
+ - name: symbol
28
+ type: data
29
+ label: {id: Simbol}
30
+ rules:
31
+ - name: iso_code
32
+ on: save
33
+ check: size(code) == 3
34
+ message: {id: Kode mata uang terdiri dari 3 huruf (ISO 4217)}
@@ -0,0 +1,39 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: exchange_rate
3
+ label: {id: Kurs}
4
+ icon: card
5
+ naming: KURS-{#####}
6
+ title_field: currency
7
+ permissions:
8
+ - {role: sales_manager, read: true, create: true, write: true, print: true}
9
+ - {role: finance_manager, read: true, create: true, write: true, print: true}
10
+ - {role: purchasing_manager, read: true, create: true, write: true, print: true}
11
+ - {role: project_admin, read: true, create: true, write: true, print: true}
12
+ - {role: head_office, read: true, create: true, write: true, print: true}
13
+ - {role: outlet_staff, read: true}
14
+ fields:
15
+ - name: currency
16
+ type: link
17
+ to: currency
18
+ label: {id: Mata uang}
19
+ required: true
20
+ in_list: true
21
+ - name: rate_date
22
+ type: date
23
+ label: {id: Tanggal}
24
+ required: true
25
+ in_list: true
26
+ - name: rate
27
+ type: float
28
+ label: {id: Kurs (Rp per 1 unit)}
29
+ required: true
30
+ in_list: true
31
+ rules:
32
+ - name: rate_positive
33
+ on: save
34
+ check: rate > 0
35
+ message: {id: Kurs harus lebih dari 0}
36
+ views:
37
+ list:
38
+ columns: [currency, rate_date, rate]
39
+ sort: -rate_date
@@ -0,0 +1,5 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
+ name: currency
3
+ version: 1.0.0
4
+ title: {id: Mata uang, en: Currencies}
5
+ requires: {rangka: '>=0.5', users: ^1.0}
@@ -0,0 +1,290 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: sales_invoice
3
+ label: {id: Faktur penjualan}
4
+ icon: invoice
5
+ is_submittable: true
6
+ naming: {series: invoice, pattern: "INV-{YYYY}-{#####}"}
7
+ title_field: customer
8
+ on_submit: [ledger.post_receivable]
9
+ on_cancel: [invoicing.reverse_receivable]
10
+ permissions:
11
+ - {role: finance_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
12
+ - {role: sales_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
13
+ - {role: sales_rep, read: true}
14
+ fields:
15
+ - name: kind
16
+ type: select
17
+ label: {id: Jenis faktur}
18
+ default: "'regular'"
19
+ in_list: true
20
+ chip: true
21
+ options:
22
+ - {value: regular, label: {id: Reguler}}
23
+ - {value: down_payment, label: {id: Uang muka (DP)}}
24
+ - {value: retention, label: {id: Retensi}}
25
+ - name: customer
26
+ type: link
27
+ to: customer
28
+ label: {id: Pelanggan}
29
+ required: true
30
+ in_list: true
31
+ peek: [outstanding, payment_days, npwp]
32
+ - name: customer_order
33
+ type: link
34
+ to: customer_order
35
+ label: {id: Pesanan pelanggan}
36
+ - name: project
37
+ type: link
38
+ to: project
39
+ label: {id: Proyek}
40
+ - name: acceptance
41
+ type: link
42
+ to: acceptance
43
+ label: {id: Berita acara}
44
+ - name: po_number
45
+ type: data
46
+ label: {id: No. PO pelanggan}
47
+ default: customer_order.po_number
48
+ - name: outlet
49
+ type: link
50
+ to: outlet
51
+ label: {id: Outlet}
52
+ - name: posting_date
53
+ type: date
54
+ label: {id: Tanggal faktur}
55
+ default: today()
56
+ required: true
57
+ in_list: true
58
+ - name: due_date
59
+ type: date
60
+ label: {id: Jatuh tempo}
61
+ default: posting_date + duration(customer.payment_days)
62
+ relative_to: posting_date
63
+ - name: items
64
+ type: table
65
+ of: sales_invoice_item
66
+ label: {id: Barang/jasa}
67
+ min_rows: 1
68
+ - name: subtotal
69
+ type: currency
70
+ label: {id: Subtotal}
71
+ # Foreign-currency document (currency is not IDR): the rupiah subtotal is the IDR twin of subtotal_fx (contract 0013),
72
+ # so dpp, PPN (assessed in rupiah), grand_total, retention, PPh 23 and amount_due stay IDR computes from it.
73
+ # Lines are entered with rate_fx; the IDR line `amount` (qty x rate) cannot see the parent's currency, so the header ignores it.
74
+ compute: "currency != '' && currency != 'IDR' ? subtotal_fx_idr : items.map(i, i.amount).sum()"
75
+ - name: discount_amount
76
+ type: currency
77
+ label: {id: Diskon}
78
+ default: '0'
79
+ - name: dp_invoice
80
+ type: link
81
+ to: sales_invoice
82
+ label: {id: Faktur uang muka}
83
+ depends_on: kind == 'regular'
84
+ - name: down_payment
85
+ type: currency
86
+ label: {id: Potongan uang muka}
87
+ default: '0'
88
+ - name: dpp
89
+ type: currency
90
+ label: {id: DPP}
91
+ compute: subtotal - discount_amount - down_payment
92
+ - name: tax_rate
93
+ type: percent
94
+ label: {id: Tarif PPN}
95
+ help: {id: 'Dari config tax.ppn_rate; 0 bila perusahaan bukan PKP atau faktur retensi (PPN sudah ditagih di faktur asal). Tersimpan di dokumen.'}
96
+ default: "kind == 'retention' ? 0 : (tax.pkp ? tax.ppn_rate : 0)"
97
+ # Not read_only: a generic amend zeroes read-only fields, and a zero dpp_den would break ppn (kernel follow-up).
98
+ - {name: dpp_num, type: int, label: {id: DPP nilai lain (pembilang)}, default: 'tax.dpp_num'}
99
+ - {name: dpp_den, type: int, label: {id: DPP nilai lain (penyebut)}, default: 'tax.dpp_den'}
100
+ - name: ppn
101
+ type: currency
102
+ label: {id: PPN (DPP x rasio DPP nilai lain x tarif)}
103
+ compute: "round(dpp * dpp_num / dpp_den * tax_rate / 100)"
104
+ - name: grand_total
105
+ type: currency
106
+ label: {id: Total}
107
+ compute: dpp + ppn
108
+ in_list: true
109
+ - name: retention_percent
110
+ type: percent
111
+ label: {id: Retensi %}
112
+ default: '0'
113
+ - name: retention_amount
114
+ type: currency
115
+ label: {id: Retensi ditahan}
116
+ compute: round(dpp * retention_percent / 100)
117
+ - name: retention_of
118
+ type: link
119
+ to: sales_invoice
120
+ label: {id: Retensi untuk faktur}
121
+ depends_on: kind == 'retention'
122
+ - name: pph23_applies
123
+ type: check
124
+ label: {id: Dipotong PPh 23}
125
+ default: 'false'
126
+ - name: pph23_rate
127
+ type: percent
128
+ label: {id: Tarif PPh 23}
129
+ default: '2'
130
+ - name: pph23_amount
131
+ type: currency
132
+ label: {id: PPh 23 dipotong pelanggan}
133
+ compute: "pph23_applies ? round(dpp * pph23_rate / 100) : 0"
134
+ - name: amount_due
135
+ type: currency
136
+ label: {id: Tagihan bersih}
137
+ compute: grand_total - retention_amount - pph23_amount
138
+ in_list: true
139
+ - name: paid_amount
140
+ type: currency
141
+ label: {id: Sudah dibayar}
142
+ read_only: true
143
+ - name: outstanding
144
+ type: currency
145
+ label: {id: Sisa tagihan}
146
+ compute: amount_due - paid_amount
147
+ in_list: true
148
+ - name: notes
149
+ type: text
150
+ label: {id: Catatan untuk pelanggan}
151
+ - {name: currency, type: data, label: {id: Mata uang}, default: "'IDR'"}
152
+ - {name: exchange_rate, type: float, label: {id: Kurs}, default: '1'} # IDR per 1 unit of the foreign currency; line `rate` stays the unit price
153
+ - {name: subtotal_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Subtotal (valas)}, compute: "sum(items.map(i, i.amount_fx))"}
154
+ # Adjustments (discount_amount, down_payment) are entered in rupiah only, also on a foreign document: the ledger, the DP checks
155
+ # and PPN read the IDR fields. Their foreign twins are derived here (IDR / exchange_rate), never entered.
156
+ - {name: dpp_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: DPP (valas)}, compute: "currency != '' && currency != 'IDR' ? round(subtotal_fx - (discount_amount + down_payment) / exchange_rate, 2) : 0"}
157
+ - {name: ppn_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: PPN (valas)}, compute: "round(dpp_fx * dpp_num / dpp_den * tax_rate / 100, 2)"}
158
+ - {name: grand_total_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Total (valas)}, compute: "dpp_fx + ppn_fx"}
159
+ - {name: retention_amount_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Retensi ditahan (valas)}, compute: "round(dpp_fx * retention_percent / 100, 2)"}
160
+ - {name: pph23_amount_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: PPh 23 dipotong (valas)}, compute: "pph23_applies ? round(dpp_fx * pph23_rate / 100, 2) : 0"}
161
+ - {name: amount_due_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Tagihan bersih (valas)}, compute: "grand_total_fx - retention_amount_fx - pph23_amount_fx"}
162
+ rules:
163
+ - name: qty_positive
164
+ on: save
165
+ check: "items.map(i, i.qty <= 0 ? 1 : 0).sum() == 0"
166
+ message: {id: Jumlah barang harus lebih dari 0}
167
+ - name: rate_not_negative
168
+ on: save
169
+ check: "items.map(i, i.rate < 0 || i.rate_fx < 0 ? 1 : 0).sum() == 0"
170
+ message: {id: Harga tidak boleh negatif}
171
+ - name: line_discount_range
172
+ on: save
173
+ check: "items.map(i, i.discount < 0 || i.discount > 100 ? 1 : 0).sum() == 0"
174
+ message: {id: Diskon baris antara 0 dan 100 persen}
175
+ - name: foreign_needs_rate
176
+ on: save
177
+ check: currency == '' || currency == 'IDR' || exchange_rate > 1
178
+ message: {id: Dokumen valas wajib diisi kursnya (rupiah per 1 unit mata uang asing)}
179
+ # Every document this invoice points at belongs to the same customer (the idiom of project.rk order_same_customer).
180
+ - name: dp_invoice_same_customer
181
+ on: save
182
+ check: dp_invoice == '' || dp_invoice.customer == customer
183
+ message: {id: Faktur uang muka harus milik pelanggan yang sama}
184
+ - name: retention_of_same_customer
185
+ on: save
186
+ check: retention_of == '' || retention_of.customer == customer
187
+ message: {id: Faktur asal retensi harus milik pelanggan yang sama}
188
+ - name: order_same_customer
189
+ on: save
190
+ check: customer_order == '' || customer_order.customer == customer
191
+ message: {id: Pesanan pelanggan harus milik pelanggan yang sama}
192
+ - name: project_same_customer
193
+ on: save
194
+ check: project == '' || project.customer == customer
195
+ message: {id: Proyek harus milik pelanggan yang sama}
196
+ - name: acceptance_same_customer
197
+ on: save
198
+ check: acceptance == '' || acceptance.project.customer == customer
199
+ message: {id: Berita acara harus untuk proyek pelanggan yang sama}
200
+ - name: tax_valid
201
+ on: save
202
+ check: dpp_den > 0 && dpp_num > 0 && dpp_num <= dpp_den && tax_rate >= 0 && tax_rate <= 100
203
+ message: {id: Tarif PPN atau faktor DPP tidak valid}
204
+ - name: ppn_needs_pkp
205
+ on: save
206
+ check: tax.pkp || tax_rate == 0
207
+ message: {id: Perusahaan bukan PKP tidak boleh memungut PPN (tarif PPN harus 0)}
208
+ - name: due_after_posting
209
+ on: save
210
+ check: due_date >= posting_date
211
+ message: {id: Jatuh tempo tidak boleh sebelum tanggal faktur}
212
+ - name: credit_limit
213
+ on: submit
214
+ level: warn
215
+ check: customer.outstanding + amount_due <= customer.credit_limit
216
+ message: {id: Melebihi batas kredit pelanggan}
217
+ - name: discount_within_subtotal
218
+ on: save
219
+ check: discount_amount <= subtotal
220
+ message: {id: Diskon tidak boleh melebihi subtotal}
221
+ - name: down_payment_within_dp
222
+ on: save
223
+ check: dp_invoice == '' || down_payment <= dp_invoice.dpp
224
+ message: {id: Potongan uang muka melebihi nilai DPP faktur uang muka}
225
+ - name: dp_needs_invoice
226
+ on: save
227
+ check: down_payment == 0 || dp_invoice != ''
228
+ message: {id: Pilih faktur uang muka yang dipotong}
229
+ - name: dp_invoice_is_dp
230
+ on: save
231
+ check: dp_invoice == '' || (dp_invoice.kind == 'down_payment' && dp_invoice.docstatus == 1)
232
+ message: {id: Faktur uang muka harus berjenis uang muka dan sudah disubmit}
233
+ - name: dp_not_on_dp
234
+ on: save
235
+ check: kind != 'down_payment' || down_payment == 0
236
+ message: {id: Faktur uang muka tidak boleh memotong uang muka}
237
+ - name: retention_needs_origin
238
+ on: save
239
+ check: kind != 'retention' || retention_of != ''
240
+ message: {id: Faktur retensi harus menunjuk faktur asalnya}
241
+ - name: retention_origin_submitted
242
+ on: save
243
+ check: retention_of == '' || retention_of.docstatus == 1
244
+ message: {id: Faktur asal retensi harus sudah disubmit dan tidak dibatalkan}
245
+ # The retained amount was taxed on the original invoice: releasing it charges no PPN again and cannot exceed what was retained.
246
+ - name: retention_within_origin
247
+ on: save
248
+ check: kind != 'retention' || retention_of == '' || (tax_rate == 0 && dpp <= retention_of.retention_amount)
249
+ message: {id: Faktur retensi tanpa PPN dan DPP-nya tidak boleh melebihi retensi yang ditahan di faktur asal}
250
+ - name: retention_range
251
+ on: save
252
+ check: retention_percent >= 0 && retention_percent <= 20
253
+ message: {id: Retensi antara 0 dan 20 persen}
254
+ - name: dpp_not_negative
255
+ on: save
256
+ check: dpp >= 0
257
+ message: {id: DPP tidak boleh negatif; kurangi potongan atau diskon}
258
+ approvals:
259
+ - name: big_invoice
260
+ on: submit
261
+ when: grand_total > 100000000
262
+ approvers: [finance_manager]
263
+ label: {id: Persetujuan keuangan untuk faktur besar, en: Finance approval for large invoices}
264
+
265
+ views:
266
+ list:
267
+ columns: [name, customer, kind, posting_date, status, grand_total, outstanding]
268
+ sort: -posting_date
269
+ form:
270
+ layout:
271
+ - section: {id: Pelanggan}
272
+ columns:
273
+ - [kind, customer, po_number, customer_order, project]
274
+ - [posting_date, due_date, outlet, acceptance]
275
+ - section: {id: Barang/jasa}
276
+ fields: [items]
277
+ - section: {id: Pajak & potongan}
278
+ columns:
279
+ - [discount_amount, dp_invoice, down_payment, tax_rate, dpp_num, dpp_den, ppn]
280
+ - [pph23_applies, pph23_rate, pph23_amount, retention_percent, retention_of, retention_amount]
281
+ - section: {id: Ringkasan}
282
+ columns:
283
+ - [subtotal, dpp, grand_total]
284
+ - [amount_due, paid_amount, outstanding]
285
+ - section: {id: Catatan}
286
+ fields: [notes]
287
+ - section: {id: Mata uang asing}
288
+ columns:
289
+ - [currency, exchange_rate, subtotal_fx]
290
+ - [grand_total_fx, amount_due_fx]
@@ -0,0 +1,37 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: sales_invoice_item
3
+ is_child: true
4
+ fields:
5
+ - name: item
6
+ type: link
7
+ to: item
8
+ label: {id: Barang/jasa}
9
+ required: true
10
+ - name: description
11
+ type: text
12
+ label: {id: Uraian}
13
+ default: item.item_name
14
+ - name: qty
15
+ type: float
16
+ label: {id: Qty}
17
+ default: '1'
18
+ - name: uom
19
+ type: link
20
+ to: uom
21
+ label: {id: Satuan}
22
+ default: "item.sales_uom != '' ? item.sales_uom : item.stock_uom"
23
+ - name: rate
24
+ type: currency
25
+ label: {id: Harga}
26
+ default: item.rate
27
+ - name: discount
28
+ type: percent
29
+ label: {id: Diskon %}
30
+ default: '0'
31
+ - name: amount
32
+ type: currency
33
+ label: {id: Jumlah}
34
+ compute: round(qty * rate * (1 - discount / 100))
35
+
36
+ - {name: rate_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Harga (valas)}, default: '0'}
37
+ - {name: amount_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Jumlah (valas)}, compute: "round(qty * rate_fx * (1 - discount / 100), 2)"}
@@ -0,0 +1,9 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
+ name: invoicing
3
+ version: 1.1.0
4
+ title: {id: Faktur, en: Invoicing}
5
+ requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, catalogue: ^1.0}
6
+ optional: {outlets: ^1.0, tax_id: ^1.0, currency: ^1.0, orders: ^1.0, projects: ^1.0}
7
+ # ledger.post_receivable is a core hook; this one is semantics fixed in docs/kernel-hooks.md.
8
+ # invoicing.from_order is declared by the orders module, where the make_invoice action lives.
9
+ hooks: [invoicing.reverse_receivable]
@@ -0,0 +1,63 @@
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; }
5
+ .items th, .items td { border-bottom: 1px solid #d6d3d1; padding: 6px 8px; text-align: left; }
6
+ .items th { background: #f6ede6; }
7
+ .num { text-align: right !important; font-variant-numeric: tabular-nums; }
8
+ .totals { width: 50%; margin: 12px 0 0 auto; border-collapse: collapse; }
9
+ .totals td { padding: 3px 8px; }
10
+ .totals tr.grand td { border-top: 2px solid #1c1917; font-weight: 700; }
11
+ .note { margin-top: 14px; font-size: 0.9em; }
12
+ {{end}}
13
+ {{template "letterhead" .}}
14
+ {{$fx := and .Doc.currency (ne .Doc.currency "IDR")}}
15
+ <h1>Faktur / Invoice</h1>
16
+ <table class="meta">
17
+ <tr><td>No. faktur</td><td>: {{.Doc.name}}</td><td>Kepada Yth.</td><td>: {{.Links.customer.customer_name}}</td></tr>
18
+ <tr><td>Tanggal</td><td>: {{date .Doc.posting_date}}</td><td>Alamat</td><td>: {{.Links.customer.address}}</td></tr>
19
+ <tr><td>Jatuh tempo</td><td>: {{date .Doc.due_date}}</td><td>NPWP</td><td>: {{.Links.customer.npwp}}</td></tr>
20
+ {{if .Doc.po_number}}<tr><td>No. PO pelanggan</td><td>: {{.Doc.po_number}}</td><td></td><td></td></tr>{{end}}
21
+ </table>
22
+ <table class="items">
23
+ <thead><tr><th>Uraian</th><th class="num">Qty</th><th>Satuan</th><th class="num">Harga satuan</th><th class="num">Diskon</th><th class="num">Jumlah</th></tr></thead>
24
+ <tbody>
25
+ {{range $row := .Doc.items}}
26
+ <tr>
27
+ <td>{{if $row.description}}{{$row.description}}{{else}}{{$row.item}}{{end}}</td>
28
+ <td class="num">{{number $row.qty}}</td>
29
+ <td>{{$row.uom}}</td>
30
+ <td class="num">{{if $fx}}{{money $row.rate_fx $.Doc.currency}}{{else}}{{rupiah $row.rate}}{{end}}</td>
31
+ <td class="num">{{if $row.discount}}{{number $row.discount}}%{{end}}</td>
32
+ <td class="num">{{if $fx}}{{money $row.amount_fx $.Doc.currency}}{{else}}{{rupiah $row.amount}}{{end}}</td>
33
+ </tr>
34
+ {{end}}
35
+ </tbody>
36
+ </table>
37
+ {{if $fx}}
38
+ <table class="totals">
39
+ <tr><td>Subtotal</td><td class="num">{{money .Doc.subtotal_fx .Doc.currency}}</td></tr>
40
+ <tr><td>DPP</td><td class="num">{{money .Doc.dpp_fx .Doc.currency}}</td></tr>
41
+ {{if taxrate .Doc .Tax}}<tr><td>PPN {{number (taxrate .Doc .Tax)}}%</td><td class="num">{{money .Doc.ppn_fx .Doc.currency}}</td></tr>{{end}}
42
+ <tr class="grand"><td>Total</td><td class="num">{{money .Doc.grand_total_fx .Doc.currency}}</td></tr>
43
+ {{if or .Doc.retention_amount .Doc.pph23_amount}}<tr class="grand"><td>Tagihan bersih</td><td class="num">{{money .Doc.amount_due_fx .Doc.currency}}</td></tr>{{end}}
44
+ </table>
45
+ <p class="note">Kurs: 1 {{.Doc.currency}} = {{rupiah .Doc.exchange_rate}}. Setara rupiah (PPN dihitung dalam rupiah):</p>
46
+ {{end}}
47
+ <table class="totals">
48
+ <tr><td>Subtotal</td><td class="num">{{rupiah .Doc.subtotal}}</td></tr>
49
+ {{if .Doc.discount_amount}}<tr><td>Diskon</td><td class="num">-{{rupiah .Doc.discount_amount}}</td></tr>{{end}}
50
+ {{if .Doc.down_payment}}<tr><td>Uang muka</td><td class="num">-{{rupiah .Doc.down_payment}}</td></tr>{{end}}
51
+ <tr><td>DPP</td><td class="num">{{rupiah .Doc.dpp}}</td></tr>
52
+ {{if taxrate .Doc .Tax}}<tr><td>PPN {{number (taxrate .Doc .Tax)}}% (DPP nilai lain {{.Doc.dpp_num}}/{{.Doc.dpp_den}})</td><td class="num">{{rupiah .Doc.ppn}}</td></tr>{{end}}
53
+ <tr class="grand"><td>Total</td><td class="num">{{rupiah .Doc.grand_total}}</td></tr>
54
+ {{if .Doc.retention_amount}}<tr><td>Retensi {{number .Doc.retention_percent}}% ditahan</td><td class="num">-{{rupiah .Doc.retention_amount}}</td></tr>{{end}}
55
+ {{if .Doc.pph23_amount}}<tr><td>PPh 23 dipotong pelanggan</td><td class="num">-{{rupiah .Doc.pph23_amount}}</td></tr>{{end}}
56
+ {{if or .Doc.retention_amount .Doc.pph23_amount}}<tr class="grand"><td>Tagihan bersih</td><td class="num">{{rupiah .Doc.amount_due}}</td></tr>{{end}}
57
+ </table>
58
+ <p class="note"><strong>Terbilang:</strong> {{terbilang .Doc.grand_total}}</p>
59
+ {{if .Doc.notes}}<p class="note">{{.Doc.notes}}</p>{{end}}
60
+ <p class="note">Bila pembayaran dipotong PPh Pasal 23, mohon kirimkan bukti potongnya kepada kami.</p>
61
+ {{template "bank_accounts" .}}
62
+ {{if taxrate .Doc .Tax}}<p class="note">Faktur pajak (e-Faktur) diterbitkan terpisah.</p>{{end}}
63
+ {{template "signature" .}}
@@ -0,0 +1,7 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/print.json
2
+ name: sales_invoice
3
+ model: sales_invoice
4
+ label: {id: Faktur, en: Invoice}
5
+ paper: A4
6
+ template: sales_invoice.html
7
+ default: true
@@ -0,0 +1,100 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: customer_order
3
+ label: {id: Pesanan pelanggan, en: Customer order}
4
+ icon: card
5
+ is_submittable: true
6
+ naming: SO-{YYYY}-{#####}
7
+ title_field: po_number
8
+ permissions:
9
+ - {role: sales_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
10
+ - {role: project_admin, read: true, create: true, write: true, submit: true}
11
+ - {role: finance_manager, read: true, print: true}
12
+ fields:
13
+ - name: customer
14
+ type: link
15
+ to: customer
16
+ label: {id: Pelanggan}
17
+ required: true
18
+ in_list: true
19
+ - name: quotation
20
+ type: link
21
+ to: quotation
22
+ label: {id: Penawaran}
23
+ in_list: true
24
+ - name: po_number
25
+ type: data
26
+ label: {id: No. PO pelanggan}
27
+ required: true
28
+ in_list: true
29
+ - name: po_date
30
+ type: date
31
+ label: {id: Tanggal PO}
32
+ required: true
33
+ - name: work_order
34
+ type: data
35
+ label: {id: No. work order}
36
+ - name: site
37
+ type: data
38
+ label: {id: Lokasi kerja}
39
+ - name: start_date
40
+ type: date
41
+ label: {id: Mulai}
42
+ - name: end_date
43
+ type: date
44
+ label: {id: Selesai}
45
+ - name: items
46
+ type: table
47
+ of: customer_order_item
48
+ label: {id: Barang/jasa}
49
+ min_rows: 1
50
+ - name: subtotal
51
+ type: currency
52
+ label: {id: Nilai pesanan (sebelum PPN)}
53
+ compute: items.map(i, i.amount).sum()
54
+ in_list: true
55
+ - name: invoiced_amount
56
+ type: currency
57
+ label: {id: Sudah ditagih}
58
+ read_only: true
59
+ - name: notes
60
+ type: text
61
+ label: {id: Catatan}
62
+ rules:
63
+ - name: quotation_same_customer
64
+ on: save
65
+ check: quotation == '' || quotation.customer == customer
66
+ message: {id: Penawaran harus milik pelanggan yang sama}
67
+ # orders.from_quotation copies the IDR line rate and the order has no currency (kernel gap S8c follow-up: conversions drop
68
+ # the currency), so an order from a foreign quotation would carry wrong amounts: refused until the hooks carry it.
69
+ - name: quotation_in_rupiah
70
+ on: save
71
+ check: quotation == '' || quotation.currency == '' || quotation.currency == 'IDR'
72
+ message: {id: Pesanan dari penawaran valas belum didukung; buat faktur valas langsung dari penawaran}
73
+ - name: end_after_start
74
+ on: save
75
+ check: start_date == '' || end_date == '' || end_date >= start_date
76
+ message: {id: Tanggal selesai tidak boleh sebelum tanggal mulai}
77
+ actions:
78
+ - name: make_invoice
79
+ label: {id: Buat faktur, en: Create invoice}
80
+ icon: invoice
81
+ primary: true
82
+ hook: invoicing.from_order
83
+ if: docstatus == 1 && app_installed('invoicing')
84
+ views:
85
+ list:
86
+ columns: [name, customer, po_number, po_date, status, subtotal, invoiced_amount]
87
+ sort: -po_date
88
+ form:
89
+ layout:
90
+ - section: {id: Pesanan}
91
+ columns:
92
+ - [customer, quotation, po_number, po_date]
93
+ - [work_order, site, start_date, end_date]
94
+ - section: {id: Barang/jasa}
95
+ fields: [items]
96
+ - section: {id: Ringkasan}
97
+ columns:
98
+ - [subtotal, invoiced_amount]
99
+ - section: {id: Catatan}
100
+ fields: [notes]
@@ -0,0 +1,30 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: customer_order_item
3
+ is_child: true
4
+ fields:
5
+ - name: item
6
+ type: link
7
+ to: item
8
+ label: {id: Barang/jasa}
9
+ required: true
10
+ - name: description
11
+ type: text
12
+ label: {id: Uraian}
13
+ default: item.item_name
14
+ - name: qty
15
+ type: float
16
+ label: {id: Qty}
17
+ default: '1'
18
+ - name: uom
19
+ type: link
20
+ to: uom
21
+ label: {id: Satuan}
22
+ default: "item.sales_uom != '' ? item.sales_uom : item.stock_uom"
23
+ - name: rate
24
+ type: currency
25
+ label: {id: Harga}
26
+ default: item.rate
27
+ - name: amount
28
+ type: currency
29
+ label: {id: Jumlah}
30
+ compute: round(qty * rate)
@@ -0,0 +1,9 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
+ name: orders
3
+ version: 1.0.0
4
+ title: {id: Pesanan pelanggan, en: Customer orders}
5
+ requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, catalogue: ^1.0}
6
+ optional: {quotation: ^1.0}
7
+ # Semantics fixed in docs/kernel-hooks.md. The make_invoice action lives on customer_order, so the hook is declared
8
+ # here; it is implemented with the invoicing hooks and needs the invoicing module installed.
9
+ hooks: [invoicing.from_order]
@@ -0,0 +1,20 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
2
+ # The daily sales sheet an outlet fills in when it has no Moka export: one row per item sold, one file per day.
3
+ name: daily_form
4
+ label: {id: Formulir penjualan harian, en: Daily sales form}
5
+ model: outlet_sales
6
+ source: csv
7
+ header_row: 1
8
+ per: outlet
9
+ key: [Tanggal, SKU]
10
+ group: [Tanggal]
11
+ map:
12
+ date: Tanggal
13
+ source: "='form'"
14
+ lines:
15
+ field: lines
16
+ map:
17
+ item: {value: SKU, match: sku}
18
+ qty: Jumlah
19
+ gross: Penjualan kotor
20
+ discount: Diskon