@rangka-os/create 0.5.0-alpha.16 → 0.5.0-alpha.18

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 (50) 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 +3 -0
  4. package/template/base/apps/grosir_distribusi/dashboards/grosir_overview.rk +3 -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 +31 -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 +7 -0
  14. package/template/base/modules/contacts/module.rk +1 -1
  15. package/template/base/modules/delivery/models/delivery_note.rk +1 -1
  16. package/template/base/modules/delivery/models/delivery_note_item.rk +1 -1
  17. package/template/base/modules/delivery/module.rk +1 -1
  18. package/template/base/modules/outlet_sales/flows/outlet_day_backfill_harian.rk +71 -0
  19. package/template/base/modules/outlet_sales/flows/outlet_day_free_sales.rk +19 -0
  20. package/template/base/modules/outlet_sales/flows/outlet_day_free_takings.rk +19 -0
  21. package/template/base/modules/outlet_sales/flows/outlet_day_on_sales.rk +19 -0
  22. package/template/base/modules/outlet_sales/flows/outlet_day_on_takings.rk +19 -0
  23. package/template/base/modules/outlet_sales/models/outlet_sales.rk +2 -0
  24. package/template/base/modules/outlet_sales/models/outlet_sales_guard.rk +5 -0
  25. package/template/base/modules/outlet_sales/models/outlet_sales_line.rk +1 -0
  26. package/template/base/modules/outlet_sales/module.rk +2 -2
  27. package/template/base/modules/outlets/models/outlet_day.rk +30 -0
  28. package/template/base/modules/outlets/models/outlet_day_backfill.rk +23 -0
  29. package/template/base/modules/outlets/module.rk +1 -1
  30. package/template/base/modules/payroll/flows/payroll_close_on_submit.rk +2 -2
  31. package/template/base/modules/payroll/module.rk +1 -1
  32. package/template/base/modules/pos/flows/outlet_day_backfill_kasir.rk +47 -0
  33. package/template/base/modules/pos/flows/pos_sale_on_cancel.rk +9 -0
  34. package/template/base/modules/pos/flows/pos_sale_on_submit.rk +16 -2
  35. package/template/base/modules/pos/models/pos_sale.rk +2 -0
  36. package/template/base/modules/pos/models/pos_sale_item.rk +1 -1
  37. package/template/base/modules/pos/module.rk +2 -2
  38. package/template/base/modules/procurement/models/purchase_request.rk +1 -0
  39. package/template/base/modules/procurement/models/purchase_request_item.rk +2 -0
  40. package/template/base/modules/procurement/module.rk +1 -1
  41. package/template/base/modules/production/models/bom.rk +3 -2
  42. package/template/base/modules/production/models/bom_line.rk +2 -2
  43. package/template/base/modules/production/models/production_batch.rk +6 -5
  44. package/template/base/modules/production/models/production_material.rk +1 -1
  45. package/template/base/modules/production/module.rk +1 -1
  46. package/template/base/modules/stock/models/stock_adjustment_value.rk +1 -0
  47. package/template/base/modules/stock/models/stock_balance.rk +2 -2
  48. package/template/base/modules/stock/models/stock_move.rk +5 -5
  49. package/template/base/modules/stock/models/stock_transfer_item.rk +1 -1
  50. 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.16",
3
+ "version": "0.5.0-alpha.18",
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,9 @@
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: managers and the owner (always). Staff land on gudang_harian or salesman_harian
6
+ # (card t_19f909b9: an outlet_staff member landed here and every widget was refused).
7
+ roles: [sales_manager, finance_manager, head_office]
5
8
  widgets:
6
9
  - name: ar_by_salesman
7
10
  type: chart
@@ -4,6 +4,9 @@ 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: managers and the owner (always). Staff land on gudang_harian or salesman_harian
8
+ # (card t_19f909b9: an outlet_staff member landed here and every widget was refused).
9
+ roles: [sales_manager, finance_manager, head_office]
7
10
  widgets:
8
11
  # riset desain K-A2: "perlu_" lists open the home as "Perlu diurus" rows (P2). Held orders are not listed here:
9
12
  # 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,31 @@
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, pelanggan yang telat bayar, 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_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}
23
+ - name: giro_due
24
+ type: list
25
+ label: {id: Giro pelanggan saya yang belum cair}
26
+ model: giro
27
+ filter: status == 'received' || status == 'deposited'
28
+ sort: effective_date
29
+ limit: 10
30
+ columns: [giro_no, customer, effective_date, amount, status]
31
+ 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
60
  help: {id: 'PPN pembelian dari pemasok ini dihitung bila PKP'}
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.5
4
4
  title: {id: Kontak, en: Contacts}
5
5
  summary:
6
6
  id: Catat pelanggan dan pemasok di satu tempat, lengkap dengan batas kredit.
@@ -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.
@@ -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: "''"}
@@ -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_on_sales
5
+ label: {id: 'Penjualan harian diajukan: hari itu milik penjualan harian'}
6
+ on: outlet_sales.submitted
7
+ steps:
8
+ - {find: outlet_day, where: outlet == event.outlet && date == event.date, as: day}
9
+ # with the cashier installed its own guards (pos_daily_form_guard, pos_takings_guard) refuse first, with their reasons;
10
+ # this one holds the day once the cashier app is removed
11
+ - if: day != null && day.source == 'kasir' && !app_installed('pos')
12
+ create: outlet_sales_guard
13
+ set: {reason: "'cashier_same_day'", document: day.document}
14
+ - if: day == null
15
+ create: outlet_day
16
+ set: {outlet: event.outlet, date: event.date, source: "'harian'", document: event.name, day_key: "event.outlet + '|' + string(event.date)"}
17
+ - if: day != null && day.source == ''
18
+ update: day
19
+ set: {source: "'harian'", document: event.name}
@@ -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_on_takings
5
+ label: {id: 'Setoran harian diajukan: hari itu milik penjualan harian'}
6
+ on: outlet_takings.submitted
7
+ steps:
8
+ - {find: outlet_day, where: outlet == event.outlet && date == event.date, as: day}
9
+ # with the cashier installed its own guards (pos_daily_form_guard, pos_takings_guard) refuse first, with their reasons;
10
+ # this one holds the day once the cashier app is removed
11
+ - if: day != null && day.source == 'kasir' && !app_installed('pos')
12
+ create: outlet_sales_guard
13
+ set: {reason: "'cashier_same_day'", document: day.document}
14
+ - if: day == null
15
+ create: outlet_day
16
+ set: {outlet: event.outlet, date: event.date, source: "'harian'", document: event.name, day_key: "event.outlet + '|' + string(event.date)"}
17
+ - if: day != null && day.source == ''
18
+ update: day
19
+ set: {source: "'harian'", document: event.name}
@@ -105,11 +105,13 @@ fields:
105
105
  help: {id: 'Diisi sistem saat diajukan: bahan resep x rata-rata biaya'}
106
106
  read_only: true
107
107
  in_list: true
108
+ hidden_for: [cashier, outlet_staff]
108
109
  - name: margin
109
110
  type: currency
110
111
  label: {id: Margin}
111
112
  compute: net_total - cogs_total
112
113
  in_list: true
114
+ hidden_for: [cashier, outlet_staff]
113
115
  # Monthly tax recap (no file): a PKP shop's sales prices include PPN, so the PPN inside net sales is
114
116
  # net x rate x dpp / (100 + rate x dpp) (Digunggung amounts). The 0,5% final PPh of PP 55/2022 depends on turnover
115
117
  # (up to Rp 4,8 miliar a year), not on PKP status, so it is shown for every shop on turnover without PPN; a shop
@@ -19,6 +19,7 @@ fields:
19
19
  - {value: sales_returned, label: {id: Penjualan sudah dikembalikan ke stok}}
20
20
  - {value: over_returned, label: {id: Retur melebihi yang diretur di kasir}}
21
21
  - {value: sales_cancelled, label: {id: Penjualan sudah dibatalkan}}
22
+ - {value: cashier_same_day, label: {id: Outlet sudah memakai kasir di tanggal itu}}
22
23
  - {name: document, type: data, label: {id: Dokumen}}
23
24
  rules:
24
25
  - name: sales_returned
@@ -33,3 +34,7 @@ rules:
33
34
  on: save
34
35
  check: reason != 'sales_cancelled'
35
36
  message: {id: 'Penjualan ini baru saja dibatalkan; retur ke stok dari penjualan yang batal tidak bisa diajukan'}
37
+ - name: cashier_same_day
38
+ on: save
39
+ check: reason != 'cashier_same_day'
40
+ message: {id: 'Outlet ini sudah memakai kasir di tanggal itu: satu sumber penjualan per hari; batalkan struk kasirnya dulu'}
@@ -38,3 +38,4 @@ fields:
38
38
  type: currency
39
39
  label: {id: Harga pokok}
40
40
  read_only: true
41
+ hidden_for: [cashier, outlet_staff]
@@ -1,12 +1,12 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
2
  name: outlet_sales
3
- version: 1.4.0
3
+ version: 1.5.2
4
4
  title: {id: Penjualan outlet, en: Outlet sales}
5
5
  summary:
6
6
  id: Rekap penjualan harian per outlet, setoran kas dan retur di kasir.
7
7
  en: Daily sales per outlet, cash deposits and returns at the till.
8
8
  category: sales
9
9
  icon: store-2-line
10
- requires: {rangka: '>=0.5', users: ^1.0, outlets: ^1.0, catalogue: ^1.0, stock: ^1.1}
10
+ requires: {rangka: '>=0.5', users: ^1.0, outlets: ^1.4, catalogue: ^1.0, stock: ^1.1}
11
11
  # Semantics fixed in docs/kernel-hooks.md (section stock): submitting posts the stock moves through the recipes.
12
12
  hooks: [stock.reverse_moves]
@@ -0,0 +1,30 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # One sales source per outlet and day (Jalur A: a daily sales record or setoran; Jalur B: the cashier). The guards of
3
+ # pos and outlet_sales read and write this record, which lives in outlets: it stays installed with either source, so
4
+ # the day keeps its source when one of the two apps is removed mid-day (audit rangka-apps#74 L1: removing
5
+ # outlet_sales let the cashier record a day that already had a daily sales record). Written by flows only; source ''
6
+ # means every document of that day was cancelled, the day is free again. Every field is read_only: a person cannot
7
+ # create, clear or duplicate a marker through the API (the kernel drops read_only input), flows still write them
8
+ # (audit #77 F1/F2); create/write stay granted because a flow's step runs with its caller's permissions.
9
+ name: outlet_day
10
+ label: {id: Sumber penjualan harian outlet, en: Outlet day sales source}
11
+ icon: calendar-check
12
+ naming: ODY-{######}
13
+ title_field: day_key
14
+ permissions:
15
+ - {role: head_office, read: true, create: true, write: true}
16
+ - {role: outlet_staff, read: true, create: true, write: true}
17
+ - {role: cashier, read: true, create: true, write: true}
18
+ fields:
19
+ - {name: outlet, type: link, to: outlet, label: {id: Outlet}, required: true, read_only: true}
20
+ - {name: date, type: date, label: {id: Tanggal}, required: true, read_only: true}
21
+ - name: source
22
+ type: select
23
+ label: {id: Sumber}
24
+ read_only: true
25
+ options:
26
+ - {value: harian, label: {id: 'Penjualan harian (form, Moka, file) atau setoran'}}
27
+ - {value: kasir, label: {id: Kasir}}
28
+ - {name: document, type: data, label: {id: Dokumen pertama}, read_only: true}
29
+ # outlet|date, once per outlet and day (two sources at the same moment: the second write fails and rolls back)
30
+ - {name: day_key, type: data, label: {id: Kunci hari}, required: true, unique: true, read_only: true}
@@ -0,0 +1,23 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # Done marker of the outlet_day backfill flows (audit rangka-apps#79 F1): one row per source (kasir from pos, harian
3
+ # from outlet_sales), written by the backfill flow in the run that finds no unmarked day left. Every later run reads
4
+ # this row by its key (one indexed row) and skips the scan of the receipts or daily records, so a finished backfill
5
+ # no longer holds the payment locks every 5 minutes. Days after the backfill are marked by the live flows
6
+ # (pos_sale_on_submit, outlet_day_on_sales, outlet_day_on_takings). Every field is read_only, like outlet_day.
7
+ name: outlet_day_backfill
8
+ label: {id: Status pelengkapan sumber penjualan harian, en: Outlet day backfill status}
9
+ icon: history-line
10
+ title_field: key
11
+ permissions:
12
+ - {role: head_office, read: true, create: true, write: true}
13
+ fields:
14
+ - name: key
15
+ type: select
16
+ label: {id: Sumber}
17
+ required: true
18
+ unique: true
19
+ read_only: true
20
+ options:
21
+ - {value: kasir, label: {id: Kasir}}
22
+ - {value: harian, label: {id: 'Penjualan harian (form, Moka, file) atau setoran'}}
23
+ - {name: done, type: check, label: {id: Selesai}, read_only: true}
@@ -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: outlets
3
- version: 1.2.0
3
+ version: 1.4.0
4
4
  title: {id: Outlet, en: Outlets}
5
5
  summary:
6
6
  id: Daftar cabang atau lokasi usaha kamu.
@@ -41,7 +41,7 @@ steps:
41
41
  event.billing_mode == 'fee_only' ? [{'item': event.fee_item, 'description': 'Management fee', 'qty': 1, 'rate': event.fee_amount, 'pph23_exclude': false}] : [{'item': event.wage_item, 'description': 'Gaji, tunjangan, lembur dan THR tenaga kerja', 'qty': 1, 'rate': event.total_cash_gross, 'pph23_exclude': true, 'ppn_exclude': true},
42
42
  {'item': event.bpjs_item, 'description': 'Iuran BPJS Ketenagakerjaan dan Kesehatan bagian perusahaan', 'qty': 1, 'rate': event.total_employer_bpjs, 'pph23_exclude': false},
43
43
  {'item': event.fee_item, 'description': 'Management fee', 'qty': 1, 'rate': event.fee_amount, 'pph23_exclude': false}]
44
- - if: event.billing_mode == 'wages_plus_fee' && old == null
44
+ - if: event.billing_mode != 'none' && event.billing_mode == 'wages_plus_fee' && old == null
45
45
  create: sales_invoice
46
46
  set:
47
47
  customer: event.customer
@@ -54,7 +54,7 @@ steps:
54
54
  [{'item': event.wage_item, 'description': 'Gaji, tunjangan, lembur dan THR tenaga kerja', 'qty': 1, 'rate': event.total_cash_gross, 'pph23_exclude': true, 'ppn_exclude': true},
55
55
  {'item': event.bpjs_item, 'description': 'Iuran BPJS Ketenagakerjaan dan Kesehatan bagian perusahaan', 'qty': 1, 'rate': event.total_employer_bpjs, 'pph23_exclude': false},
56
56
  {'item': event.fee_item, 'description': 'Management fee', 'qty': 1, 'rate': event.fee_amount, 'pph23_exclude': false}]
57
- - if: event.billing_mode == 'fee_only' && old == null
57
+ - if: event.billing_mode != 'none' && event.billing_mode == 'fee_only' && old == null
58
58
  create: sales_invoice
59
59
  set:
60
60
  customer: event.customer
@@ -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: payroll
3
- version: 1.2.0
3
+ version: 1.2.1
4
4
  title: {id: Penggajian, en: Payroll}
5
5
  summary:
6
6
  id: Data gaji pekerja, periode gaji, slip gaji dan tutup periode.
@@ -0,0 +1,47 @@
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 1000 submitted receipts 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 kasir 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_kasir
12
+ label: {id: 'Lengkapi sumber penjualan harian dari struk kasir lama'}
13
+ schedule: '*/5 * * * *'
14
+ steps:
15
+ - find_all: outlet_day_backfill
16
+ where: "key == 'kasir'"
17
+ limit: 1
18
+ as: st
19
+ - find_all: outlet_day
20
+ if: "size(st) == 0"
21
+ as: marked
22
+ - find_all: pos_sale
23
+ if: "size(st) == 0"
24
+ where: "docstatus == 1 && outlet != null && outlet != '' && !marked.exists(m, m.outlet == outlet && m.date == date)"
25
+ limit: 1000
26
+ as: r
27
+ - for_each: "r"
28
+ if: "size(st) == 0"
29
+ as: d
30
+ do:
31
+ - find_all: outlet_day
32
+ where: "day_key == d.outlet + '|' + string(d.date)"
33
+ limit: 1
34
+ as: k
35
+ - create: outlet_day
36
+ if: "size(k) == 0"
37
+ set:
38
+ outlet: "d.outlet"
39
+ date: "d.date"
40
+ source: "'kasir'"
41
+ document: "d.name"
42
+ day_key: "d.outlet + '|' + string(d.date)"
43
+ - create: outlet_day_backfill
44
+ if: "size(st) == 0 && size(r) == 0"
45
+ set:
46
+ key: "'kasir'"
47
+ done: "true"
@@ -31,3 +31,12 @@ steps:
31
31
  cogs_total: s.cogs_total - event.cogs_total
32
32
  void_count: s.void_count + 1
33
33
  void_total: s.void_total + event.grand_total
34
+ # the last receipt of the day voided: the day is free again for a daily sales record (outlet_day, audit #74 L1)
35
+ - find_all: pos_sale
36
+ where: outlet == event.outlet && date == event.date && docstatus == 1
37
+ limit: 1
38
+ as: left
39
+ - {find: outlet_day, where: outlet == event.outlet && date == event.date, as: day}
40
+ - if: day != null && day.source == 'kasir' && left.size() == 0
41
+ update: day
42
+ set: {source: "''", document: "''"}
@@ -15,7 +15,9 @@ steps:
15
15
  where: outlet == event.outlet && date == event.date && docstatus == 1
16
16
  limit: 1
17
17
  as: forms
18
- - if: forms != null && forms.size() > 0
18
+ # a site without outlet_sales skips the find above, so forms is never declared: app_installed is checked first
19
+ # (&& stops there); `forms != null` alone read an undeclared name and failed every receipt (host smoke, 13 Nov)
20
+ - if: app_installed('outlet_sales') && forms.size() > 0
19
21
  create: pos_guard
20
22
  set:
21
23
  reason: "'daily_sales_same_day'"
@@ -26,11 +28,23 @@ steps:
26
28
  where: outlet == event.outlet && date == event.date && docstatus == 1
27
29
  limit: 1
28
30
  as: takings
29
- - if: takings != null && takings.size() > 0
31
+ - if: app_installed('outlet_sales') && takings.size() > 0
30
32
  create: pos_guard
31
33
  set:
32
34
  reason: "'daily_sales_same_day'"
33
35
  document: takings[0].name
36
+ # one sales source per outlet and day, kept in outlets (installed with either source): a daily sales record or
37
+ # setoran marked the day 'harian', which holds even after the outlet_sales app is removed (audit #74 L1)
38
+ - {find: outlet_day, where: outlet == event.outlet && date == event.date, as: day}
39
+ - if: day != null && day.source == 'harian'
40
+ create: pos_guard
41
+ set: {reason: "'daily_sales_same_day'", document: day.document}
42
+ - if: day == null
43
+ create: outlet_day
44
+ set: {outlet: event.outlet, date: event.date, source: "'kasir'", document: event.name, day_key: "event.outlet + '|' + string(event.date)"}
45
+ - if: day != null && day.source == ''
46
+ update: day
47
+ set: {source: "'kasir'", document: event.name}
34
48
  - if: s == null
35
49
  create: pos_guard
36
50
  set: {reason: "'shift_closed'", document: event.name}
@@ -110,10 +110,12 @@ fields:
110
110
  label: {id: Harga pokok}
111
111
  help: {id: 'Diisi sistem saat dibayar: barang atau bahan resep x rata-rata biaya'}
112
112
  read_only: true
113
+ hidden_for: [cashier, outlet_staff]
113
114
  - name: margin
114
115
  type: currency
115
116
  label: {id: Margin}
116
117
  compute: grand_total - cogs_total
118
+ hidden_for: [cashier, outlet_staff]
117
119
  # Same monthly tax recap as outlet_sales: PPN inside a PKP shop's prices, and the 0,5% final PPh of PP 55/2022.
118
120
  - name: ppn_in_sales
119
121
  type: currency
@@ -43,4 +43,4 @@ fields:
43
43
  label: {id: Jumlah}
44
44
  compute: round(qty * rate * (100 - discount_pct) / 100)
45
45
  - {name: note, type: data, label: {id: Catatan}, help: {id: 'Misalnya kurang manis, tanpa es'}}
46
- - {name: cogs, type: currency, label: {id: Harga pokok}, read_only: true}
46
+ - {name: cogs, type: currency, label: {id: Harga pokok}, read_only: true, hidden_for: [cashier, outlet_staff]}
@@ -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: pos
3
- version: 1.0.0
3
+ version: 1.1.2
4
4
  title: {id: Kasir, en: Point of sale}
5
5
  summary:
6
6
  id: Kasir di browser dengan sesi kas, transaksi dan tutup sesi per outlet.
@@ -17,6 +17,6 @@ icon: shopping-basket-line
17
17
  # (cancel, then amend without the returned items) only on its own day while its shift is open.
18
18
  # Sales of an outlet run either here or through outlet_sales (Jalur A), never both: an outlet whose sales_source is
19
19
  # 'kasir' takes no daily form or POS file, and a sale needs that source when outlet_sales is installed.
20
- requires: {rangka: '>=0.5', users: ^1.2, catalogue: ^1.3, outlets: ^1.2, stock: ^1.2}
20
+ requires: {rangka: '>=0.5', users: ^1.2, catalogue: ^1.3, outlets: ^1.4, stock: ^1.2}
21
21
  hooks: [stock.reverse_moves]
22
22
  optional: {accounting: ^1.2, outlet_sales: ^1.1}
@@ -44,6 +44,7 @@ fields:
44
44
  label: {id: Perkiraan total}
45
45
  compute: items.map(i, i.amount).sum()
46
46
  in_list: true
47
+ hidden_for: [outlet_staff]
47
48
  - name: state
48
49
  type: select
49
50
  label: {id: Status permintaan}
@@ -29,7 +29,9 @@ fields:
29
29
  type: currency
30
30
  label: {id: Perkiraan harga}
31
31
  default: item.standard_cost
32
+ hidden_for: [outlet_staff]
32
33
  - name: amount
33
34
  type: currency
34
35
  label: {id: Jumlah}
35
36
  compute: round(qty * est_rate)
37
+ hidden_for: [outlet_staff]
@@ -1,6 +1,6 @@
1
1
  # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
2
  name: procurement
3
- version: 1.1.1
3
+ version: 1.1.2
4
4
  title: {id: Pembelian, en: Procurement}
5
5
  summary:
6
6
  id: Permintaan dan pesanan pembelian, barang datang dan tagihan pemasok.
@@ -20,14 +20,15 @@ fields:
20
20
  - {name: lines, type: table, of: bom_line, label: {id: Bahan}, min_rows: 1}
21
21
  - {name: byproducts, type: table, of: bom_byproduct, label: {id: Produk sampingan}}
22
22
  - {name: labour_per_unit, type: currency, label: {id: Upah borongan per satuan}, help: {id: Jumlah tarif semua tahap per satuan hasil}}
23
- - {name: overhead_per_unit, type: currency, label: {id: Overhead per satuan}, help: {id: 'Tarif sederhana: listrik, gas, sewa dibagi hasil sebulan'}}
24
- - {name: material_cost, type: currency, label: {id: Biaya bahan per batch}, compute: "lines.map(l, l.cost).sum()"}
23
+ - {name: overhead_per_unit, type: currency, label: {id: Overhead per satuan}, help: {id: 'Tarif sederhana: listrik, gas, sewa dibagi hasil sebulan'}, hidden_for: [outlet_staff]}
24
+ - {name: material_cost, type: currency, label: {id: Biaya bahan per batch}, compute: "lines.map(l, l.cost).sum()", hidden_for: [outlet_staff]}
25
25
  - {name: byproduct_share, type: float, label: {id: Porsi produk sampingan (%)}, compute: "byproducts.map(b, b.cost_share).sum()"}
26
26
  - name: unit_cost
27
27
  type: currency
28
28
  label: {id: HPP standar per satuan}
29
29
  compute: "output_qty > 0 ? round(material_cost * (100 - byproduct_share) / 100 / output_qty) + labour_per_unit + overhead_per_unit : 0"
30
30
  in_list: true
31
+ hidden_for: [outlet_staff]
31
32
  - {name: notes, type: text, label: {id: Catatan}}
32
33
  rules:
33
34
  - name: output_positive
@@ -7,5 +7,5 @@ fields:
7
7
  - {name: uom, type: link, to: uom, label: {id: Satuan}, default: item.stock_uom}
8
8
  - {name: semi_finished, type: check, label: {id: Setengah jadi}, compute: "item.default_bom != ''"}
9
9
  # a semi-finished item costs what its own BOM says (rolled up); a raw material its standard cost
10
- - {name: unit_cost, type: currency, label: {id: Biaya per satuan}, compute: "item.default_bom != '' ? item.default_bom.unit_cost : item.standard_cost"}
11
- - {name: cost, type: currency, label: {id: Biaya}, compute: round(qty * unit_cost)}
10
+ - {name: unit_cost, type: currency, label: {id: Biaya per satuan}, compute: "item.default_bom != '' ? item.default_bom.unit_cost : item.standard_cost", hidden_for: [outlet_staff]}
11
+ - {name: cost, type: currency, label: {id: Biaya}, compute: round(qty * unit_cost), hidden_for: [outlet_staff]}
@@ -42,18 +42,19 @@ fields:
42
42
  - {name: yield_percent, type: float, label: {id: Rendemen aktual (%)}, compute: "planned_qty > 0 ? round(good_qty * 10000 / planned_qty) / 100 : 0"}
43
43
  - {name: share_total, type: float, label: {id: Total porsi biaya (%)}, compute: "outputs.map(o, o.cost_share).sum()"}
44
44
  - {name: main_share, type: float, label: {id: Porsi biaya produk utama (%)}, compute: "outputs.map(o, o.item == item ? o.cost_share : 0).sum()"}
45
- - {name: material_cost, type: currency, label: {id: Biaya bahan (aktual)}, read_only: true}
45
+ - {name: material_cost, type: currency, label: {id: Biaya bahan (aktual)}, read_only: true, hidden_for: [outlet_staff]}
46
46
  - {name: labour_cost, type: currency, label: {id: Upah borongan}, compute: "labour.map(l, l.amount).sum()"}
47
- - {name: overhead_rate, type: currency, label: {id: Overhead per satuan}, default: bom.overhead_per_unit}
48
- - {name: overhead_cost, type: currency, label: {id: Overhead}, compute: round(good_qty * overhead_rate)}
47
+ - {name: overhead_rate, type: currency, label: {id: Overhead per satuan}, default: bom.overhead_per_unit, hidden_for: [outlet_staff]}
48
+ - {name: overhead_cost, type: currency, label: {id: Overhead}, compute: round(good_qty * overhead_rate), hidden_for: [outlet_staff]}
49
49
  # The product's share of the materials, plus all wages and overhead (by-products carry only their material share).
50
50
  - name: hpp_total
51
51
  type: currency
52
52
  label: {id: HPP batch (produk utama)}
53
53
  compute: "round(material_cost * main_share / 100) + labour_cost + overhead_cost"
54
54
  in_list: true
55
- - {name: hpp_per_unit, type: currency, label: {id: HPP per satuan}, compute: "good_qty > 0 ? round(hpp_total / good_qty) : 0", in_list: true}
56
- - {name: standard_unit_cost, type: currency, label: {id: HPP standar per satuan}, default: bom.unit_cost, read_only: true}
55
+ hidden_for: [outlet_staff]
56
+ - {name: hpp_per_unit, type: currency, label: {id: HPP per satuan}, compute: "good_qty > 0 ? round(hpp_total / good_qty) : 0", in_list: true, hidden_for: [outlet_staff]}
57
+ - {name: standard_unit_cost, type: currency, label: {id: HPP standar per satuan}, default: bom.unit_cost, read_only: true, hidden_for: [outlet_staff]}
57
58
  - {name: notes, type: text, label: {id: Catatan}}
58
59
  stock:
59
60
  date: production_date
@@ -5,4 +5,4 @@ fields:
5
5
  - {name: item, type: link, to: item, label: {id: Bahan}, required: true}
6
6
  - {name: qty, type: float, label: {id: Qty terpakai}}
7
7
  - {name: uom, type: link, to: uom, label: {id: Satuan}, default: item.stock_uom}
8
- - {name: cogs, type: currency, label: {id: Biaya bahan}, read_only: true}
8
+ - {name: cogs, type: currency, label: {id: Biaya bahan}, read_only: true, hidden_for: [outlet_staff]}
@@ -5,7 +5,7 @@
5
5
  # at the value of those materials through the declarative stock block of contract 0021 (K-o). Wages and overhead are
6
6
  # in the batch's actual cost (HPP) but not in the stock value until K-r.
7
7
  name: production
8
- version: 1.2.0
8
+ version: 1.2.2
9
9
  title: {id: Produksi, en: Production}
10
10
  summary:
11
11
  id: Resep produksi, SPK, hasil per batch dan upah borongan.
@@ -58,6 +58,7 @@ fields:
58
58
  label: {id: 'Nilai (negatif = keluar)'}
59
59
  read_only: true
60
60
  in_list: true
61
+ hidden_for: [outlet_staff, cashier]
61
62
  - name: entry_key
62
63
  type: data
63
64
  label: {id: Kunci baris}
@@ -13,8 +13,8 @@ fields:
13
13
  - {name: outlet, type: link, to: outlet, label: {id: Outlet}, required: true, read_only: true, in_list: true}
14
14
  - {name: item, type: link, to: item, label: {id: Barang}, required: true, read_only: true, in_list: true}
15
15
  - {name: qty, type: float, label: {id: Qty}, read_only: true, in_list: true}
16
- - {name: value, type: currency, label: {id: Nilai}, read_only: true, in_list: true}
17
- - {name: avg_cost, type: currency, label: {id: Rata-rata biaya}, read_only: true, in_list: true}
16
+ - {name: value, type: currency, label: {id: Nilai}, read_only: true, in_list: true, hidden_for: [outlet_staff, cashier]}
17
+ - {name: avg_cost, type: currency, label: {id: Rata-rata biaya}, read_only: true, in_list: true, hidden_for: [outlet_staff, cashier]}
18
18
  - {name: negative, type: check, label: {id: Stok minus}, compute: qty < 0, in_list: true}
19
19
  - {name: last_move, type: data, label: {id: Mutasi terakhir}, read_only: true}
20
20
  # Written by stock.post_moves on each sale out of this balance (rangka-os#59); older
@@ -14,11 +14,11 @@ fields:
14
14
  - {name: outlet, type: link, to: outlet, label: {id: Outlet}, required: true, read_only: true, in_list: true}
15
15
  - {name: item, type: link, to: item, label: {id: Barang}, required: true, read_only: true, in_list: true}
16
16
  - {name: qty, type: float, label: {id: 'Qty (+ masuk, - keluar)'}, read_only: true, in_list: true}
17
- - {name: unit_cost, type: currency, label: {id: Biaya per satuan}, read_only: true}
18
- - {name: value, type: currency, label: {id: Nilai}, read_only: true, in_list: true}
17
+ - {name: unit_cost, type: currency, label: {id: Biaya per satuan}, read_only: true, hidden_for: [outlet_staff, cashier]}
18
+ - {name: value, type: currency, label: {id: Nilai}, read_only: true, in_list: true, hidden_for: [outlet_staff, cashier]}
19
19
  - {name: balance_qty, type: float, label: {id: Saldo qty}, read_only: true, in_list: true}
20
- - {name: balance_value, type: currency, label: {id: Saldo nilai}, read_only: true}
21
- - {name: avg_cost, type: currency, label: {id: Rata-rata biaya}, read_only: true}
20
+ - {name: balance_value, type: currency, label: {id: Saldo nilai}, read_only: true, hidden_for: [outlet_staff, cashier]}
21
+ - {name: avg_cost, type: currency, label: {id: Rata-rata biaya}, read_only: true, hidden_for: [outlet_staff, cashier]}
22
22
  - {name: negative, type: check, label: {id: Stok minus}, read_only: true, in_list: true}
23
23
  - {name: voucher_type, type: data, label: {id: Jenis dokumen}, read_only: true, in_list: true}
24
24
  - {name: voucher, type: data, label: {id: Dokumen}, read_only: true, in_list: true}
@@ -27,7 +27,7 @@ fields:
27
27
  # cancelled sale nets to zero. A Retur ke stok (outlet_return, contract 0022) counts against them: goods back on the
28
28
  # shelf are not sold and their cost leaves HPP, so a unit sold again is not counted (or paid to a consignor) twice.
29
29
  - {name: sold_qty, type: float, label: {id: Qty terjual}, compute: "voucher_type == 'outlet_sales' || voucher_type == 'outlet_return' ? -qty : 0"}
30
- - {name: sold_cost, type: currency, label: {id: Harga pokok terjual}, compute: "voucher_type == 'outlet_sales' || voucher_type == 'outlet_return' ? -value : 0"}
30
+ - {name: sold_cost, type: currency, label: {id: Harga pokok terjual}, compute: "voucher_type == 'outlet_sales' || voucher_type == 'outlet_return' ? -value : 0", hidden_for: [outlet_staff, cashier]}
31
31
  - name: reason
32
32
  type: select
33
33
  label: {id: Sebab}
@@ -30,5 +30,5 @@ fields:
30
30
  type: float
31
31
  label: {id: Qty stok}
32
32
  compute: "packing == '' ? qty : qty * packing.factor"
33
- - {name: unit_cost, type: currency, read_only: true, label: {id: Biaya per satuan}, help: {id: 'Diisi saat transfer dikirim: rata-rata outlet asal'}}
33
+ - {name: unit_cost, type: currency, read_only: true, label: {id: Biaya per satuan}, help: {id: 'Diisi saat transfer dikirim: rata-rata outlet asal'}, hidden_for: [outlet_staff, cashier]}
34
34
  - {name: received_qty, type: float, read_only: true, label: {id: Qty diterima}}
@@ -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: stock
3
- version: 1.3.0
3
+ version: 1.3.1
4
4
  title: {id: Stok, en: Stock}
5
5
  summary:
6
6
  id: Saldo dan mutasi stok, transfer antar outlet, opname dan penyesuaian.