@rangka-os/create 0.5.0-alpha.17 → 0.5.0-alpha.19

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 (58) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/grosir_distribusi/app.rk +1 -1
  3. package/template/base/apps/grosir_distribusi/dashboards/grosir_ar.rk +4 -0
  4. package/template/base/apps/grosir_distribusi/dashboards/grosir_overview.rk +4 -0
  5. package/template/base/apps/grosir_distribusi/dashboards/gudang_harian.rk +33 -0
  6. package/template/base/apps/grosir_distribusi/dashboards/salesman_harian.rk +51 -0
  7. package/template/base/modules/accounting/flows/gl_payment_post.rk +4 -4
  8. package/template/base/modules/accounting/models/gl_entry.rk +6 -3
  9. package/template/base/modules/accounting/module.rk +1 -1
  10. package/template/base/modules/catalogue/models/item.rk +2 -0
  11. package/template/base/modules/catalogue/module.rk +1 -1
  12. package/template/base/modules/contacts/models/customer.rk +25 -0
  13. package/template/base/modules/contacts/models/vendor.rk +8 -1
  14. package/template/base/modules/contacts/module.rk +1 -1
  15. package/template/base/modules/courses/flows/charge_invoice_on_submit.rk +1 -0
  16. package/template/base/modules/courses/module.rk +2 -2
  17. package/template/base/modules/delivery/models/delivery_note.rk +1 -1
  18. package/template/base/modules/delivery/models/delivery_note_item.rk +1 -1
  19. package/template/base/modules/delivery/module.rk +1 -1
  20. package/template/base/modules/invoicing/models/sales_invoice.rk +44 -5
  21. package/template/base/modules/invoicing/module.rk +1 -1
  22. package/template/base/modules/outlet_sales/flows/outlet_day_backfill_harian.rk +71 -0
  23. package/template/base/modules/outlet_sales/flows/outlet_day_free_sales.rk +19 -0
  24. package/template/base/modules/outlet_sales/flows/outlet_day_free_takings.rk +19 -0
  25. package/template/base/modules/outlet_sales/flows/outlet_day_on_sales.rk +19 -0
  26. package/template/base/modules/outlet_sales/flows/outlet_day_on_takings.rk +19 -0
  27. package/template/base/modules/outlet_sales/models/outlet_sales.rk +2 -0
  28. package/template/base/modules/outlet_sales/models/outlet_sales_guard.rk +5 -0
  29. package/template/base/modules/outlet_sales/models/outlet_sales_line.rk +1 -0
  30. package/template/base/modules/outlet_sales/module.rk +2 -2
  31. package/template/base/modules/outlets/models/outlet_day.rk +30 -0
  32. package/template/base/modules/outlets/models/outlet_day_backfill.rk +25 -0
  33. package/template/base/modules/outlets/module.rk +1 -1
  34. package/template/base/modules/payroll/flows/payroll_close_on_submit.rk +2 -2
  35. package/template/base/modules/payroll/module.rk +1 -1
  36. package/template/base/modules/pos/flows/outlet_day_backfill_kasir.rk +61 -0
  37. package/template/base/modules/pos/flows/pos_sale_on_cancel.rk +9 -0
  38. package/template/base/modules/pos/flows/pos_sale_on_submit.rk +16 -2
  39. package/template/base/modules/pos/models/pos_sale.rk +3 -0
  40. package/template/base/modules/pos/models/pos_sale_item.rk +1 -1
  41. package/template/base/modules/pos/module.rk +2 -2
  42. package/template/base/modules/procurement/models/purchase_order.rk +7 -1
  43. package/template/base/modules/procurement/models/purchase_request.rk +1 -0
  44. package/template/base/modules/procurement/models/purchase_request_item.rk +2 -0
  45. package/template/base/modules/procurement/models/vendor_bill.rk +7 -1
  46. package/template/base/modules/procurement/module.rk +1 -1
  47. package/template/base/modules/production/models/bom.rk +3 -2
  48. package/template/base/modules/production/models/bom_line.rk +2 -2
  49. package/template/base/modules/production/models/production_batch.rk +6 -5
  50. package/template/base/modules/production/models/production_material.rk +1 -1
  51. package/template/base/modules/production/module.rk +1 -1
  52. package/template/base/modules/quotation/models/quotation.rk +6 -0
  53. package/template/base/modules/quotation/module.rk +1 -1
  54. package/template/base/modules/stock/models/stock_adjustment_value.rk +1 -0
  55. package/template/base/modules/stock/models/stock_balance.rk +2 -2
  56. package/template/base/modules/stock/models/stock_move.rk +5 -5
  57. package/template/base/modules/stock/models/stock_transfer_item.rk +1 -1
  58. package/template/base/modules/stock/module.rk +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rangka-os/create",
3
- "version": "0.5.0-alpha.17",
3
+ "version": "0.5.0-alpha.19",
4
4
  "description": "Start a Rangka OS project: npm create @rangka-os@latest my-shop",
5
5
  "license": "Elastic-2.0",
6
6
  "homepage": "https://rangka-os.github.io/rangka-os/guide/quick-start",
@@ -27,7 +27,7 @@ modules:
27
27
  distribution: ^1.0
28
28
  delivery: ^1.0
29
29
  bank_statement: ^1.0
30
- dashboards: [grosir_overview, grosir_ar]
30
+ dashboards: [grosir_overview, grosir_ar, gudang_harian, salesman_harian]
31
31
  roles: [sales_manager, finance_manager, head_office, field_sales]
32
32
  home: {dashboard: grosir_overview}
33
33
  # recipe is installed with stock but has no menu entry: a distributor sells goods as they are.
@@ -2,6 +2,10 @@
2
2
  name: grosir_ar
3
3
  label: {id: Piutang dan penagihan, en: Receivables and collections}
4
4
  cache: 5m
5
+ # Money of the whole company: the sales and finance managers and the owner (always). Head office is the warehouse
6
+ # in a distributor (it reads neither giro nor payments) and lands on gudang_harian (card t_2619c876). Staff land on gudang_harian or salesman_harian
7
+ # (card t_19f909b9: an outlet_staff member landed here and every widget was refused).
8
+ roles: [sales_manager, finance_manager]
5
9
  widgets:
6
10
  - name: ar_by_salesman
7
11
  type: chart
@@ -4,6 +4,10 @@ label: {id: Ringkasan distribusi, en: Distribution overview}
4
4
  default_period: 30
5
5
  cache: 5m
6
6
  # The owner's daily questions: what did the salesmen sell, which orders wait, who pays late, which giro is due.
7
+ # Money of the whole company: the sales and finance managers and the owner (always). Head office is the warehouse
8
+ # in a distributor (it reads neither giro nor payments) and lands on gudang_harian (card t_2619c876). Staff land on gudang_harian or salesman_harian
9
+ # (card t_19f909b9: an outlet_staff member landed here and every widget was refused).
10
+ roles: [sales_manager, finance_manager]
7
11
  widgets:
8
12
  # riset desain K-A2: "perlu_" lists open the home as "Perlu diurus" rows (P2). Held orders are not listed here:
9
13
  # they already wait in Persetujuan, which the same panel shows.
@@ -0,0 +1,33 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/dashboard.json
2
+ name: gudang_harian
3
+ label: {id: Gudang hari ini, en: Warehouse today}
4
+ description: {id: 'Untuk staf gudang dan outlet: barang yang harus diterima, opname, dan penyesuaian di tempat kerja kamu'}
5
+ default_period: 1
6
+ cache: 1m
7
+ # The home of outlet staff (contract 0030 §3: the first dashboard whose roles names one of the user's roles). Only
8
+ # models outlet_staff may read, row-scoped to the member's outlets (role scope outlet, from_outlet, to_outlet), and no
9
+ # money: the owner's grosir_overview and grosir_ar are for the managers (card t_19f909b9).
10
+ roles: [outlet_staff, head_office]
11
+ widgets:
12
+ - {name: receipts_draft, type: number, label: {id: Penerimaan belum diajukan}, model: goods_receipt, filter: docstatus == 0, good_when: down, span: 3}
13
+ - {name: receipts_today, type: number, label: {id: Penerimaan hari ini}, model: goods_receipt, filter: "docstatus == 1 && received_on == today()", span: 3}
14
+ - {name: to_receive, type: number, label: {id: Kiriman belum diterima}, model: stock_transfer, filter: "docstatus == 1 && state != 'received' && (user.outlets.size() == 0 || to_outlet in user.outlets)", good_when: down, span: 3}
15
+ - {name: counts_draft, type: number, label: {id: Opname belum diajukan}, model: stock_count, filter: docstatus == 0, good_when: down, span: 3}
16
+ - name: receipt_list
17
+ type: list
18
+ label: {id: Penerimaan barang yang belum diajukan}
19
+ model: goods_receipt
20
+ filter: docstatus == 0
21
+ sort: received_on
22
+ limit: 20
23
+ columns: [name, received_on, vendor, outlet]
24
+ span: 12
25
+ - name: receive_list
26
+ type: list
27
+ label: {id: Kiriman yang harus diterima}
28
+ model: stock_transfer
29
+ filter: "docstatus == 1 && state != 'received' && (user.outlets.size() == 0 || to_outlet in user.outlets)"
30
+ sort: transfer_date
31
+ limit: 20
32
+ columns: [name, transfer_date, from_outlet, to_outlet, state]
33
+ span: 12
@@ -0,0 +1,51 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/dashboard.json
2
+ name: salesman_harian
3
+ label: {id: Pelanggan saya, en: My customers}
4
+ description: {id: 'Untuk salesman: pesanan yang belum jalan, piutang dan tagihan, pelanggan yang ditahan kredit, dan giro dari pelanggan kamu'}
5
+ default_period: 30
6
+ cache: 1m
7
+ # The home of a salesman (contract 0030 §3). Every model here is row-scoped to the member's own records (role
8
+ # field_sales: salesman == user.name), so the numbers are theirs, never the company's (card t_19f909b9).
9
+ roles: [field_sales]
10
+ widgets:
11
+ - name: perlu_telat_bayar
12
+ type: list
13
+ label: {id: Pelanggan saya yang telat bayar}
14
+ model: customer
15
+ filter: oldest_open_due != '' && oldest_open_due < today()
16
+ sort: oldest_open_due
17
+ limit: 10
18
+ columns: [customer_name, oldest_open_due, outstanding]
19
+ span: 12
20
+ - {name: orders_open, type: number, label: {id: Pesanan belum jalan}, description: {id: Draft dan pesanan yang menunggu persetujuan kredit}, model: customer_order, aggregate: count, filter: docstatus == 0, good_when: down, span: 4}
21
+ - {name: my_sales, type: number, label: {id: Penjualan saya (faktur)}, description: {id: 'Nilai sebelum PPN, faktur pelanggan kamu pada periode ini'}, model: sales_invoice, aggregate: sum, field: subtotal, filter: docstatus == 1, period: posting_date, compact: true, span: 4}
22
+ - {name: my_overdue, type: number, label: {id: Piutang saya lewat jatuh tempo}, model: sales_invoice, aggregate: sum, field: outstanding, filter: "docstatus == 1 && outstanding > 0 && due_date < today()", compact: true, good_when: down, span: 4}
23
+ - {name: my_collected, type: number, label: {id: Tertagih (periode ini)}, model: payment, aggregate: sum, field: amount, filter: "docstatus == 1 && direction == 'receive' && method != 'sales_return'", period: payment_date, compact: true, span: 4}
24
+ - {name: my_ar, type: number, label: {id: Piutang pelanggan saya}, model: sales_invoice, aggregate: sum, field: outstanding, filter: docstatus == 1 && outstanding > 0, compact: true, good_when: down, span: 4}
25
+ - name: giro_due
26
+ type: list
27
+ label: {id: Giro pelanggan saya yang belum cair}
28
+ model: giro
29
+ filter: status == 'received' || status == 'deposited'
30
+ sort: effective_date
31
+ limit: 10
32
+ columns: [giro_no, customer, effective_date, amount, status]
33
+ span: 12
34
+ # the collection tools a salesman needs on the road (card t_2619c876): who is on hold and which invoices are overdue
35
+ - name: on_hold
36
+ type: list
37
+ label: {id: Pelanggan saya yang ditahan kredit}
38
+ model: customer
39
+ filter: credit_hold
40
+ limit: 20
41
+ columns: [customer_name, credit_hold_reason, outstanding]
42
+ span: 12
43
+ - name: overdue_list
44
+ type: list
45
+ label: {id: Faktur pelanggan saya lewat jatuh tempo}
46
+ model: sales_invoice
47
+ filter: "docstatus == 1 && outstanding > 0 && due_date < today()"
48
+ sort: due_date
49
+ limit: 20
50
+ columns: [name, customer, due_date, outstanding]
51
+ span: 12
@@ -14,11 +14,11 @@ steps:
14
14
  limit: 1
15
15
  as: locks
16
16
  - create: gl_entry
17
- if: "(event.direction == 'receive' ? (event.direction == 'receive' && event.method == 'sales_return' && ret != null && ret.return_total > 0 ? round(event.amount * 1.0 * ret.return_value / ret.return_total) : event.amount) : event.amount + event.withheld_total) != 0"
17
+ if: "(event.direction == 'receive' ? (event.direction == 'receive' && event.method == 'sales_return' && event.sales_return != '' && ret != null && ret.return_total > 0 ? round(event.amount * 1.0 * ret.return_value / ret.return_total) : event.amount) : event.amount + event.withheld_total) != 0"
18
18
  set:
19
19
  posting_date: "event.payment_date"
20
20
  account: "event.direction == 'receive' ? (event.method == 'cash' ? '11100' : (event.method == 'sales_return' ? '41200' : '11200')) : '21100'"
21
- amount: "event.direction == 'receive' ? (event.direction == 'receive' && event.method == 'sales_return' && ret != null && ret.return_total > 0 ? round(event.amount * 1.0 * ret.return_value / ret.return_total) : event.amount) : event.amount + event.withheld_total"
21
+ amount: "event.direction == 'receive' ? (event.direction == 'receive' && event.method == 'sales_return' && event.sales_return != '' && ret != null && ret.return_total > 0 ? round(event.amount * 1.0 * ret.return_value / ret.return_total) : event.amount) : event.amount + event.withheld_total"
22
22
  voucher_type: event.model
23
23
  voucher: event.name
24
24
  entry: "'post'"
@@ -26,11 +26,11 @@ steps:
26
26
  party: "event.direction == 'receive' ? event.customer : event.vendor"
27
27
  lock_date: "locks.size() > 0 ? locks[0].closed_until : null"
28
28
  - create: gl_entry
29
- if: "(event.direction == 'receive' && event.method == 'sales_return' && ret != null && ret.return_total > 0 ? event.amount - round(event.amount * 1.0 * ret.return_value / ret.return_total) : 0) != 0"
29
+ if: "(event.direction == 'receive' && event.method == 'sales_return' && event.sales_return != '' && ret != null && ret.return_total > 0 ? event.amount - round(event.amount * 1.0 * ret.return_value / ret.return_total) : 0) != 0"
30
30
  set:
31
31
  posting_date: "event.payment_date"
32
32
  account: "'21200'"
33
- amount: "event.direction == 'receive' && event.method == 'sales_return' && ret != null && ret.return_total > 0 ? event.amount - round(event.amount * 1.0 * ret.return_value / ret.return_total) : 0"
33
+ amount: "event.direction == 'receive' && event.method == 'sales_return' && event.sales_return != '' && ret != null && ret.return_total > 0 ? event.amount - round(event.amount * 1.0 * ret.return_value / ret.return_total) : 0"
34
34
  voucher_type: event.model
35
35
  voucher: event.name
36
36
  entry: "'post'"
@@ -85,12 +85,15 @@ fields:
85
85
  - {value: '61900', label: {id: '6-1900 Beban operasional lain'}}
86
86
  - {value: '69100', label: {id: '6-9100 Beban pajak'}}
87
87
  # accounts:end
88
+ # outlet staff and cashiers read the lines of their documents only because the posting flows run as them (a cancel
89
+ # finds the post lines); the amounts are not theirs to see (contract 0027: flows still read them; card t_7eeaf99a)
88
90
  - name: amount
89
91
  type: currency
90
92
  label: {id: 'Nilai (+ debit, - kredit)'}
91
93
  required: true
92
- - {name: debit, type: currency, label: {id: Debit}, compute: "amount > 0 ? amount : 0", in_list: true}
93
- - {name: credit, type: currency, label: {id: Kredit}, compute: "amount < 0 ? 0 - amount : 0", in_list: true}
94
+ hidden_for: [outlet_staff, cashier]
95
+ - {name: debit, type: currency, label: {id: Debit}, compute: "amount > 0 ? amount : 0", in_list: true, hidden_for: [outlet_staff, cashier]}
96
+ - {name: credit, type: currency, label: {id: Kredit}, compute: "amount < 0 ? 0 - amount : 0", in_list: true, hidden_for: [outlet_staff, cashier]}
94
97
  - name: voucher_type
95
98
  type: data
96
99
  label: {id: Jenis dokumen}
@@ -121,7 +124,7 @@ fields:
121
124
  - {name: party, type: data, label: {id: Pihak}}
122
125
  # a project expense's credit line: the vendor bill whose cost it moved into the project
123
126
  - {name: against, type: data, label: {id: Tagihan asal}, hidden: true}
124
- - {name: bill_left, type: currency, label: {id: Sisa biaya tagihan}, hidden: true}
127
+ - {name: bill_left, type: currency, label: {id: Sisa biaya tagihan}, hidden: true, hidden_for: [outlet_staff, cashier]}
125
128
  - {name: lock_date, type: date, label: {id: Buku ditutup sampai}, hidden: true}
126
129
  - name: account_class
127
130
  type: select
@@ -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: accounting
3
- version: 1.3.0
3
+ version: 1.3.3
4
4
  title: {id: Akuntansi, en: Accounting}
5
5
  summary:
6
6
  id: Jurnal, saldo awal, tutup buku dan laporan keuangan dari transaksi yang sudah dicatat.
@@ -96,6 +96,7 @@ fields:
96
96
  - name: standard_cost
97
97
  type: currency
98
98
  label: {id: Harga pokok standar}
99
+ hidden_for: [outlet_staff, cashier, field_sales, sales_rep]
99
100
  - name: stock
100
101
  type: float
101
102
  label: {id: Stok}
@@ -113,6 +114,7 @@ fields:
113
114
  label: {id: Harga setor titipan}
114
115
  help: {id: 'Yang dibayar ke penitip per barang terjual'}
115
116
  depends_on: app_installed('consignment') && consignor != ''
117
+ hidden_for: [outlet_staff, cashier, field_sales, sales_rep]
116
118
  - name: notes
117
119
  type: text
118
120
  label: {id: Catatan}
@@ -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: catalogue
3
- version: 1.3.0
3
+ version: 1.3.1
4
4
  title: {id: Katalog, en: Catalogue}
5
5
  summary:
6
6
  id: Daftar barang dan jasa dengan kategori, satuan dan daftar harga.
@@ -10,8 +10,15 @@ permissions:
10
10
  - {role: purchasing_manager, read: true, create: true, write: true, print: true}
11
11
  - {role: project_admin, read: true, create: true, write: true, print: true}
12
12
  - {role: head_office, read: true, create: true, write: true, print: true}
13
+ # outlet staff pick customers (POS, outlet sales, returns) but never see their money, credit or tax identity: the
14
+ # money and identity fields are hidden_for outlet_staff (contract 0027; card t_5ba74e22)
13
15
  - {role: outlet_staff, read: true}
14
16
  - {role: sales_rep, read: true, create: true, write: true}
17
+ # credit_limit, credit_hold, credit_hold_reason, payment_days and price_tier (the customer's credit and terms) are
18
+ # decided by the sales and finance managers (and the owner):
19
+ # they are read_only_for every other role that writes customers (rangka-os contract 0027 §6; card t_6c114aa0)
20
+ # country and vat_collector set the Coretax transaction code of every invoice (02 government, 03 other collectors):
21
+ # a tax decision of finance (and the owner), read_only_for every other role that writes customers (card t_d8afe122)
15
22
  # a salesman sees his own customers (role scope salesman) and cannot change their credit
16
23
  - {role: field_sales, read: true}
17
24
  # course schools: the payer of a student (student_billing_on_create makes one for a person on their own)
@@ -40,15 +47,19 @@ fields:
40
47
  label: {id: Tempo (hari)}
41
48
  default: '30'
42
49
  in_list: true
50
+ read_only_for: [purchasing_manager, project_admin, head_office, sales_rep, course_admin]
43
51
  - name: credit_limit
44
52
  type: currency
45
53
  label: {id: Batas kredit}
46
54
  default: '25000000'
55
+ hidden_for: [outlet_staff]
56
+ read_only_for: [purchasing_manager, project_admin, head_office, sales_rep, course_admin]
47
57
  - name: outstanding
48
58
  type: currency
49
59
  label: {id: Piutang}
50
60
  read_only: true
51
61
  in_list: true
62
+ hidden_for: [outlet_staff]
52
63
  # Distributor sales (module distribution): the salesman who visits the customer, the route, the price tier, and
53
64
  # the credit control that holds its orders (customer_order approvals). oldest_open_due is the earliest due date of
54
65
  # its open invoices, kept by the distribution flows; an order is held while it is before today.
@@ -76,33 +87,42 @@ fields:
76
87
  - {value: retail, label: {id: Eceran}}
77
88
  - {value: wholesale, label: {id: Grosir}}
78
89
  - {value: agent, label: {id: Agen}}
90
+ read_only_for: [purchasing_manager, project_admin, head_office, sales_rep, course_admin]
79
91
  - name: credit_hold
80
92
  type: check
81
93
  label: {id: Tahan kredit}
82
94
  help: {id: Semua pesanan pelanggan ini butuh persetujuan sampai dicentang lagi}
83
95
  depends_on: app_installed('distribution')
96
+ read_only_for: [purchasing_manager, project_admin, head_office, sales_rep, course_admin]
97
+ hidden_for: [outlet_staff]
84
98
  - name: credit_hold_reason
85
99
  type: data
86
100
  label: {id: Alasan tahan kredit}
87
101
  depends_on: app_installed('distribution')
102
+ hidden_for: [outlet_staff]
103
+ read_only_for: [purchasing_manager, project_admin, head_office, sales_rep, course_admin]
88
104
  - name: oldest_open_due
89
105
  type: date
90
106
  label: {id: Jatuh tempo tertua yang belum lunas}
91
107
  read_only: true
92
108
  depends_on: app_installed('distribution')
109
+ hidden_for: [outlet_staff]
93
110
  - name: open_orders
94
111
  type: currency
95
112
  label: {id: Pesanan belum ditagih (dengan PPN)}
96
113
  read_only: true
97
114
  depends_on: app_installed('distribution')
115
+ hidden_for: [outlet_staff]
98
116
  - name: uninvoiced_deliveries
99
117
  type: currency
100
118
  label: {id: Terkirim belum ditagih (dengan PPN)}
101
119
  read_only: true
102
120
  depends_on: app_installed('delivery')
121
+ hidden_for: [outlet_staff]
103
122
  - name: npwp
104
123
  type: npwp
105
124
  label: {id: NPWP}
125
+ hidden_for: [outlet_staff]
106
126
  # Tax identity for e-Faktur (module coretax, contract 0029): a buyer is identified by NPWP 16 digits plus its NITKU
107
127
  # (22 digits, NPWP + 000000 for the head office), else NIK, else a passport. vat_collector sets the transaction
108
128
  # code (02 government, 03 other collectors such as BUMN).
@@ -111,27 +131,32 @@ fields:
111
131
  label: {id: NITKU}
112
132
  help: {id: 'ID TKU 22 digit dari Coretax. Kosongkan bila pusat (NPWP + 000000)'}
113
133
  depends_on: app_installed('coretax')
134
+ hidden_for: [outlet_staff]
114
135
  - name: nik
115
136
  type: data
116
137
  label: {id: NIK}
117
138
  help: {id: 'Untuk pembeli orang pribadi tanpa NPWP'}
118
139
  depends_on: app_installed('coretax')
140
+ hidden_for: [outlet_staff]
119
141
  - name: passport_no
120
142
  type: data
121
143
  label: {id: No. paspor}
122
144
  help: {id: 'Untuk pembeli warga negara asing tanpa NPWP/NIK'}
123
145
  depends_on: app_installed('coretax')
146
+ hidden_for: [outlet_staff]
124
147
  - name: country
125
148
  type: data
126
149
  label: {id: Kode negara}
127
150
  help: {id: 'Kode 3 huruf, IDN untuk Indonesia'}
128
151
  default: "'IDN'"
129
152
  depends_on: app_installed('coretax')
153
+ read_only_for: [sales_manager, purchasing_manager, project_admin, head_office, sales_rep, course_admin]
130
154
  - name: vat_collector
131
155
  type: select
132
156
  label: {id: Pemungut PPN}
133
157
  default: "'none'"
134
158
  depends_on: app_installed('coretax')
159
+ read_only_for: [sales_manager, purchasing_manager, project_admin, head_office, sales_rep, course_admin]
135
160
  options:
136
161
  - {value: none, label: {id: Bukan pemungut}}
137
162
  - {value: government, label: {id: Instansi pemerintah}}
@@ -11,6 +11,9 @@ permissions:
11
11
  - {role: project_admin, read: true, create: true, write: true, print: true}
12
12
  - {role: head_office, read: true, create: true, write: true, print: true}
13
13
  - {role: outlet_staff, read: true}
14
+ # pkp opens PPN masukan on the vendor's bills and pph23_object_code is the default tax object of its bills: tax
15
+ # decisions of finance (and the owner), read_only_for every other role that writes vendors, so the person who records
16
+ # a bill cannot also make its vendor PKP (rangka-os contract 0027 §6; card t_d8afe122)
14
17
  fields:
15
18
  - name: vendor_name
16
19
  type: data
@@ -50,20 +53,24 @@ fields:
50
53
  label: {id: Kode objek PPh 23}
51
54
  help: {id: 'Kode objek pajak Coretax, misalnya 24-104-17 jasa penyedia tenaga kerja, 24-104-36 kebersihan, 24-100-02 sewa'}
52
55
  depends_on: app_installed('coretax')
56
+ read_only_for: [sales_manager, purchasing_manager, project_admin, head_office]
53
57
  - name: pkp
54
58
  type: check
55
59
  label: {id: Pemasok PKP}
56
- help: {id: 'PPN pembelian dari pemasok ini dihitung bila PKP'}
60
+ help: {id: 'PPN pembelian dari pemasok ini dihitung bila PKP. Diatur pemilik atau bagian keuangan setelah memeriksa SPPKP pemasok'}
57
61
  default: 'false'
62
+ read_only_for: [sales_manager, purchasing_manager, project_admin, head_office]
58
63
  - name: payment_days
59
64
  type: int
60
65
  label: {id: Tempo (hari)}
61
66
  default: '30'
67
+ hidden_for: [outlet_staff]
62
68
  - name: outstanding
63
69
  type: currency
64
70
  label: {id: Utang}
65
71
  read_only: true
66
72
  in_list: true
73
+ hidden_for: [outlet_staff]
67
74
  - name: contacts
68
75
  type: table
69
76
  of: contact_person
@@ -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: contacts
3
- version: 1.2.0
3
+ version: 1.2.6
4
4
  title: {id: Kontak, en: Contacts}
5
5
  summary:
6
6
  id: Catat pelanggan dan pemasok di satu tempat, lengkap dengan batas kredit.
@@ -45,6 +45,7 @@ steps:
45
45
  customer: event.customer
46
46
  posting_date: event.invoice_date
47
47
  tax_rate: '0'
48
+ tax_rate_reason: "'exempt'"
48
49
  notes: "'Biaya kursus ' + event.description + ' [' + event.name + ']'"
49
50
  items: "[{'item': event.item, 'description': event.description, 'qty': 1, 'rate': event.amount}]"
50
51
  - if: "!event.vat_exempt"
@@ -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: courses
3
- version: 1.2.0
3
+ version: 1.3.0
4
4
  title: {id: Kursus dan pelatihan, en: Courses and training}
5
5
  summary:
6
6
  id: Program kursus, angkatan, peserta, pendaftaran, jadwal pertemuan dan tagihannya.
@@ -11,4 +11,4 @@ icon: graduation-cap-line
11
11
  # teacher and a weekly schedule, students (a person or an employee of a client company), enrollments, sessions with
12
12
  # attendance, and charges (paid in full, in instalments or monthly) that become draft sales invoices. Research and plan:
13
13
  # rangka research_notes/kursus, plans/kursus.md.
14
- requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, catalogue: ^1.0, invoicing: ^1.0}
14
+ requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, catalogue: ^1.0, invoicing: ^1.8}
@@ -36,7 +36,7 @@ fields:
36
36
  label: {id: Lewat batas kredit saat diajukan}
37
37
  hidden: true
38
38
  compute: "app_installed('distribution') && customer.credit_limit > 0 && customer.outstanding + customer.uninvoiced_deliveries + delivery_total > customer.credit_limit"
39
- - {name: cogs_total, type: currency, label: {id: Harga pokok barang dikirim}, read_only: true}
39
+ - {name: cogs_total, type: currency, label: {id: Harga pokok barang dikirim}, read_only: true, hidden_for: [field_sales]}
40
40
  - {name: received_by, type: data, label: {id: Diterima oleh}}
41
41
  - {name: notes, type: text, label: {id: Catatan}}
42
42
  stock:
@@ -8,4 +8,4 @@ fields:
8
8
  - {name: uom, type: link, to: uom, label: {id: Satuan}, default: item.stock_uom}
9
9
  # the unit's name for the printed surat jalan (a print reads only top-level links)
10
10
  - {name: uom_name, type: data, label: {id: Nama satuan}, hidden: true, compute: "uom != '' ? uom.uom_name : ''"}
11
- - {name: cogs, type: currency, label: {id: Harga pokok}, read_only: true}
11
+ - {name: cogs, type: currency, label: {id: Harga pokok}, read_only: true, hidden_for: [field_sales]}
@@ -5,7 +5,7 @@
5
5
  # it. order_fulfilment keeps per order what was ordered, delivered, returned and invoiced, because a submitted order
6
6
  # cannot be written (K-p, contract 0022, will move this into the kernel's conversions).
7
7
  name: delivery
8
- version: 1.1.1
8
+ version: 1.1.2
9
9
  title: {id: Pengiriman dan retur, en: Delivery and returns}
10
10
  summary:
11
11
  id: Surat jalan, pemenuhan pesanan dan retur penjualan.
@@ -120,14 +120,33 @@ fields:
120
120
  type: currency
121
121
  label: {id: DPP}
122
122
  compute: subtotal - discount_amount - down_payment
123
+ # The output PPN rate and DPP factor are finance's decision (audit tax-rate-config F1, card t_d6461a33): a rate of 0
124
+ # empties the faktur code and drops the invoice from the Coretax XML while the PPN is still owed, so a sales_manager
125
+ # (or any role that only reads invoices) cannot set them; their input is dropped and the company's config applies.
126
+ # read_only_for, not read_only: a generic amend zeroes read-only fields, and a zero dpp_den would break ppn.
123
127
  - name: tax_rate
124
128
  type: percent
125
129
  label: {id: Tarif PPN}
126
- help: {id: 'Dari config tax.ppn_rate; 0 bila perusahaan bukan PKP atau faktur retensi (PPN sudah ditagih di faktur asal). Tersimpan di dokumen.'}
130
+ help: {id: 'Dari pengaturan pajak; 0 bila bukan PKP atau faktur retensi. Hanya pemilik atau bagian keuangan yang dapat mengubahnya.'}
127
131
  default: "kind == 'retention' ? 0 : (tax.pkp ? tax.ppn_rate : 0)"
128
- # Not read_only: a generic amend zeroes read-only fields, and a zero dpp_den would break ppn (kernel follow-up).
129
- - {name: dpp_num, type: int, label: {id: DPP nilai lain (pembilang)}, default: 'tax.dpp_num'}
130
- - {name: dpp_den, type: int, label: {id: DPP nilai lain (penyebut)}, default: 'tax.dpp_den'}
132
+ read_only_for: [sales_manager, sales_rep, field_sales, head_office, project_admin]
133
+ # the legal ground of a PKP invoice at 0% (card t_3106eb6c): without one the PPN owed would leave the Coretax XML
134
+ # unnoticed. Export of BKP/JKP is 0% (UU PPN Pasal 7 ayat 2); not subject to PPN (Pasal 4A) or no delivery carries
135
+ # none; facilities dibebaskan (Pasal 16B, PP 49/2022: education) and tidak dipungut are faktur codes 08 and 07 in
136
+ # Coretax (their XML is a follow-up card), recorded here at 0% with that ground.
137
+ - name: tax_rate_reason
138
+ type: select
139
+ label: {id: Dasar tarif PPN 0}
140
+ help: {id: 'Wajib bila perusahaan PKP mengisi tarif PPN 0. Diisi pemilik atau bagian keuangan.'}
141
+ depends_on: tax_rate == 0 && kind != 'retention'
142
+ read_only_for: [sales_manager, sales_rep, field_sales, head_office, project_admin]
143
+ options:
144
+ - {value: export, label: {id: 'Ekspor BKP/JKP (PPN 0%, Pasal 7 ayat 2)'}}
145
+ - {value: exempt, label: {id: 'Dibebaskan (Pasal 16B, PP 49/2022, mis. jasa pendidikan)'}}
146
+ - {value: not_collected, label: {id: 'Tidak dipungut (Pasal 16B, mis. kawasan berikat)'}}
147
+ - {value: not_taxable, label: {id: 'Bukan objek PPN (Pasal 4A) atau bukan penyerahan'}}
148
+ - {name: dpp_num, type: int, label: {id: DPP nilai lain (pembilang)}, default: 'tax.dpp_num', read_only_for: [sales_manager, sales_rep, field_sales, head_office, project_admin]}
149
+ - {name: dpp_den, type: int, label: {id: DPP nilai lain (penyebut)}, default: 'tax.dpp_den', read_only_for: [sales_manager, sales_rep, field_sales, head_office, project_admin]}
131
150
  # The PPN base: the DPP, or with config tax.ppn_fee_only (kernel contract 0010 §8, default off) the fee part of it:
132
151
  # a manpower firm that bills the workers' wages on their own line charges PPN on its fee only (DPP nilai lain, PMK
133
152
  # 83/2012 art. 4). Like PPh 23 (pph23_lines_base / pph23_dp_base): the lines not marked ppn_exclude, as a share of
@@ -418,6 +437,18 @@ rules:
418
437
  on: save
419
438
  check: dpp_den > 0 && dpp_num > 0 && dpp_num <= dpp_den && tax_rate >= 0 && tax_rate <= 100
420
439
  message: {id: Tarif PPN atau faktor DPP tidak valid}
440
+ # a PKP invoice at 0% names its ground (card t_3106eb6c); a ground left on a rate above 0 is ignored (Coretax and
441
+ # ppn read the rate), so raising the rate never trips over the hidden field (audit zero-rate N2)
442
+ - name: zero_rate_needs_reason
443
+ on: save
444
+ check: "!tax.pkp || kind == 'retention' || tax_rate > 0 || tax_rate_reason != ''"
445
+ message: {id: 'Faktur PKP bertarif PPN 0 perlu dasar (ekspor, dibebaskan, tidak dipungut, bukan objek). Diisi pemilik atau bagian keuangan'}
446
+ # the rate is at most the company's (tax.ppn_rate): lower rates are lawful (PPN besaran tertentu, an earlier
447
+ # statutory 10% or 11%), a higher one only inflates the PPN, e.g. a typed 100% (audit tax-fields N2; card t_81bc5551)
448
+ - name: tax_rate_at_most_config
449
+ on: save
450
+ check: "tax_rate <= tax.ppn_rate"
451
+ message: {id: 'Tarif PPN tidak boleh melebihi tarif di pengaturan pajak usaha. Draft lama: ubah dulu tarifnya ke tarif pengaturan'}
421
452
  - name: ppn_needs_pkp
422
453
  on: save
423
454
  check: tax.pkp || tax_rate == 0
@@ -478,6 +509,14 @@ approvals:
478
509
  when: grand_total > 100000000
479
510
  approvers: [finance_manager]
480
511
  label: {id: Persetujuan keuangan untuk faktur besar, en: Finance approval for large invoices}
512
+ # a PKP invoice at another rate or DPP factor than the company's waits for finance (audit F5: a 1/10 factor amended) (card t_d6461a33, audit invoice-tax-lock F1/F2):
513
+ # the field lock alone lets a sales_manager reach rate 0 by turning a retention draft into a regular invoice, or by
514
+ # amending a finance export invoice; finance and the owner approve their own (an export at 0%, a pre-2025 document)
515
+ - name: ppn_rate_differs
516
+ on: submit
517
+ when: "tax.pkp && kind != 'retention' && (tax_rate != tax.ppn_rate || dpp_num * tax.dpp_den != tax.dpp_num * dpp_den)"
518
+ approvers: [finance_manager]
519
+ label: {id: 'Tarif PPN atau DPP berbeda dari pengaturan pajak: perlu persetujuan keuangan', en: 'PPN rate or DPP differs from the tax settings: finance approval'}
481
520
 
482
521
  views:
483
522
  list:
@@ -494,7 +533,7 @@ views:
494
533
  fields: [items]
495
534
  - section: {id: Pajak & potongan}
496
535
  columns:
497
- - [discount_amount, dp_invoice, down_payment, tax_rate, dpp_num, dpp_den, ppn_base, ppn]
536
+ - [discount_amount, dp_invoice, down_payment, tax_rate, tax_rate_reason, dpp_num, dpp_den, ppn_base, ppn]
498
537
  - [pph23_applies, pph23_rate, pph23_amount, retention_percent, retention_of, retention_amount]
499
538
  - section: {id: Ringkasan}
500
539
  columns:
@@ -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: invoicing
3
- version: 1.7.0
3
+ version: 1.8.0
4
4
  title: {id: Faktur, en: Invoicing}
5
5
  summary:
6
6
  id: Buat faktur penjualan, pilih cara bayar termasuk QRIS, dan kirim pengingat tagihan.
@@ -0,0 +1,71 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Backfill of outlets/outlet_day for days submitted before it existed (audit rangka-apps#77 F3): the kernel has no
3
+ # migrate hook for .rk, so every run marks the days of up to 500 submitted daily sales records and setoran that have no marker yet.
4
+ # One read of the documents per run (audit #79 F2), then per document one indexed lookup of its day_key, so two
5
+ # documents of one day give one marker and a day already marked (any source, also one freed by a cancel) is skipped:
6
+ # the run is safe to repeat and a day never gets two markers (day_key is unique). A document without an outlet is left
7
+ # out so it cannot stall the queue (audit #79 F5). The run that finds nothing left writes outlet_day_backfill
8
+ # key harian done; from then on a run reads only that one row (audit #79 F1: the finished backfill read every document
9
+ # each 5 minutes under the payment locks). The documents are read newest first (the kernel's order without sort:, so the
10
+ # read stops at limit), so a backfilled marker names a document of its day, not always the first (audit #79 F6).
11
+ name: outlet_day_backfill_harian
12
+ label: {id: 'Lengkapi sumber penjualan harian dari penjualan harian dan setoran lama'}
13
+ schedule: '*/5 * * * *'
14
+ steps:
15
+ - find_all: outlet_day_backfill
16
+ where: "key == 'harian'"
17
+ limit: 1
18
+ as: st
19
+ - find_all: outlet_day
20
+ if: "size(st) == 0"
21
+ as: marked1
22
+ - find_all: outlet_sales
23
+ if: "size(st) == 0"
24
+ where: "docstatus == 1 && outlet != null && outlet != '' && !marked1.exists(m, m.outlet == outlet && m.date == date)"
25
+ limit: 500
26
+ as: f
27
+ - for_each: "f"
28
+ if: "size(st) == 0"
29
+ as: d1
30
+ do:
31
+ - find_all: outlet_day
32
+ where: "day_key == d1.outlet + '|' + string(d1.date)"
33
+ limit: 1
34
+ as: k1
35
+ - create: outlet_day
36
+ if: "size(k1) == 0"
37
+ set:
38
+ outlet: "d1.outlet"
39
+ date: "d1.date"
40
+ source: "'harian'"
41
+ document: "d1.name"
42
+ day_key: "d1.outlet + '|' + string(d1.date)"
43
+ - find_all: outlet_day
44
+ if: "size(st) == 0"
45
+ as: marked2
46
+ - find_all: outlet_takings
47
+ if: "size(st) == 0"
48
+ where: "docstatus == 1 && outlet != null && outlet != '' && !marked2.exists(m, m.outlet == outlet && m.date == date)"
49
+ limit: 500
50
+ as: g
51
+ - for_each: "g"
52
+ if: "size(st) == 0"
53
+ as: d2
54
+ do:
55
+ - find_all: outlet_day
56
+ where: "day_key == d2.outlet + '|' + string(d2.date)"
57
+ limit: 1
58
+ as: k2
59
+ - create: outlet_day
60
+ if: "size(k2) == 0"
61
+ set:
62
+ outlet: "d2.outlet"
63
+ date: "d2.date"
64
+ source: "'harian'"
65
+ document: "d2.name"
66
+ day_key: "d2.outlet + '|' + string(d2.date)"
67
+ - create: outlet_day_backfill
68
+ if: "size(st) == 0 && size(f) == 0 && size(g) == 0"
69
+ set:
70
+ key: "'harian'"
71
+ done: "true"
@@ -0,0 +1,19 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # One sales source per outlet and day, kept in outlets/outlet_day so it holds when the cashier app is removed (audit
3
+ # rangka-apps#74 L1); the cashier's own guards (module pos) stay as they are.
4
+ name: outlet_day_free_sales
5
+ label: {id: 'Penjualan harian dibatalkan: hari itu bebas lagi kalau tidak ada dokumen lain'}
6
+ on: outlet_sales.cancelled
7
+ steps:
8
+ - find_all: outlet_sales
9
+ where: outlet == event.outlet && date == event.date && docstatus == 1
10
+ limit: 1
11
+ as: forms
12
+ - find_all: outlet_takings
13
+ where: outlet == event.outlet && date == event.date && docstatus == 1
14
+ limit: 1
15
+ as: takings
16
+ - {find: outlet_day, where: outlet == event.outlet && date == event.date, as: day}
17
+ - if: day != null && day.source == 'harian' && forms.size() == 0 && takings.size() == 0
18
+ update: day
19
+ set: {source: "''", document: "''"}
@@ -0,0 +1,19 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # One sales source per outlet and day, kept in outlets/outlet_day so it holds when the cashier app is removed (audit
3
+ # rangka-apps#74 L1); the cashier's own guards (module pos) stay as they are.
4
+ name: outlet_day_free_takings
5
+ label: {id: 'Setoran harian dibatalkan: hari itu bebas lagi kalau tidak ada dokumen lain'}
6
+ on: outlet_takings.cancelled
7
+ steps:
8
+ - find_all: outlet_sales
9
+ where: outlet == event.outlet && date == event.date && docstatus == 1
10
+ limit: 1
11
+ as: forms
12
+ - find_all: outlet_takings
13
+ where: outlet == event.outlet && date == event.date && docstatus == 1
14
+ limit: 1
15
+ as: takings
16
+ - {find: outlet_day, where: outlet == event.outlet && date == event.date, as: day}
17
+ - if: day != null && day.source == 'harian' && forms.size() == 0 && takings.size() == 0
18
+ update: day
19
+ set: {source: "''", document: "''"}