@rangka-os/create 0.5.0-alpha.4 → 0.5.0-alpha.6

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 (110) hide show
  1. package/package.json +1 -1
  2. package/template/base/apps/crm/processes/lead_to_cash.rk +8 -0
  3. package/template/base/apps/fnb_cabang/dashboards/stock_recap.rk +6 -4
  4. package/template/base/apps/jasa_proyek/app.rk +5 -4
  5. package/template/base/apps/jasa_proyek/dashboards/jasa_overview.rk +20 -0
  6. package/template/base/apps/jasa_proyek/dashboards/project_margin.rk +66 -0
  7. package/template/base/apps/jasa_proyek/processes/quote_to_cash.rk +10 -0
  8. package/template/base/apps/ritel_cabang/app.rk +50 -0
  9. package/template/base/apps/ritel_cabang/dashboards/ritel_overview.rk +123 -0
  10. package/template/base/apps/ritel_cabang/dashboards/ritel_stock.rk +146 -0
  11. package/template/base/apps/ritel_cabang/dashboards/ritel_tax.rk +76 -0
  12. package/template/base/connectors/loyverse/connector.rk +93 -0
  13. package/template/base/connectors/moka/connector.rk +81 -0
  14. package/template/base/connectors/whatsapp_business/connector.rk +16 -0
  15. package/template/base/connectors/whatsapp_business/templates.md +32 -0
  16. package/template/base/connectors/xendit/connector.rk +179 -0
  17. package/template/base/modules/bank_statement/flows/bank_transaction_claim.rk +19 -0
  18. package/template/base/modules/bank_statement/flows/bank_transaction_confirm.rk +43 -0
  19. package/template/base/modules/bank_statement/flows/bank_transaction_link_locked.rk +11 -0
  20. package/template/base/modules/bank_statement/flows/bank_transaction_matched.rk +13 -0
  21. package/template/base/modules/bank_statement/flows/bank_transaction_release.rk +11 -0
  22. package/template/base/modules/bank_statement/flows/bank_transaction_suggest.rk +21 -0
  23. package/template/base/modules/bank_statement/flows/bank_transaction_unmatched.rk +11 -0
  24. package/template/base/modules/bank_statement/imports/bank_statement_csv.rk +25 -0
  25. package/template/base/modules/bank_statement/models/bank_transaction.rk +124 -0
  26. package/template/base/modules/bank_statement/models/bank_transaction_claim.rk +49 -0
  27. package/template/base/modules/bank_statement/module.rk +7 -0
  28. package/template/base/modules/catalogue/imports/item_list.rk +20 -0
  29. package/template/base/modules/catalogue/imports/item_master.rk +25 -0
  30. package/template/base/modules/catalogue/models/item.rk +34 -1
  31. package/template/base/modules/catalogue/models/item_category.rk +26 -0
  32. package/template/base/modules/consignment/flows/consignment_bill.rk +36 -0
  33. package/template/base/modules/consignment/flows/consignment_bill_cancelled.rk +14 -0
  34. package/template/base/modules/consignment/models/consignment_settlement.rk +93 -0
  35. package/template/base/modules/consignment/models/consignment_settlement_item.rk +37 -0
  36. package/template/base/modules/consignment/module.rk +10 -0
  37. package/template/base/modules/contacts/imports/customer_list.rk +17 -0
  38. package/template/base/modules/contacts/imports/vendor_list.rk +16 -0
  39. package/template/base/modules/invoicing/flows/invoice_due_digest.rk +12 -0
  40. package/template/base/modules/invoicing/flows/milestone_invoiced.rk +23 -0
  41. package/template/base/modules/invoicing/flows/milestone_reopened.rk +19 -0
  42. package/template/base/modules/invoicing/flows/project_billed_on_cancel.rk +16 -0
  43. package/template/base/modules/invoicing/flows/project_billed_on_submit.rk +16 -0
  44. package/template/base/modules/invoicing/flows/project_revenue_on_cancel.rk +22 -0
  45. package/template/base/modules/invoicing/flows/project_revenue_on_submit.rk +17 -0
  46. package/template/base/modules/invoicing/models/invoice_reminder.rk +83 -0
  47. package/template/base/modules/invoicing/models/sales_invoice.rk +93 -3
  48. package/template/base/modules/invoicing/models/sales_invoice_item.rk +9 -0
  49. package/template/base/modules/invoicing/module.rk +1 -1
  50. package/template/base/modules/invoicing/print/sales_invoice.html +2 -1
  51. package/template/base/modules/invoicing/print/sales_invoice_whatsapp.html +33 -0
  52. package/template/base/modules/invoicing/print/sales_invoice_whatsapp.rk +8 -0
  53. package/template/base/modules/outlet_sales/flows/moka_legacy_key_overlap.rk +22 -0
  54. package/template/base/modules/outlet_sales/imports/daily_form.rk +3 -1
  55. package/template/base/modules/outlet_sales/imports/loyverse_receipts.rk +28 -0
  56. package/template/base/modules/outlet_sales/imports/moka_item_details.rk +14 -4
  57. package/template/base/modules/outlet_sales/imports/pos_sales_file.rk +28 -0
  58. package/template/base/modules/outlet_sales/imports/takings_file.rk +23 -0
  59. package/template/base/modules/outlet_sales/models/outlet_sales.rk +72 -6
  60. package/template/base/modules/outlet_sales/models/outlet_sales_line.rk +1 -0
  61. package/template/base/modules/outlet_sales/models/outlet_takings.rk +83 -0
  62. package/template/base/modules/outlet_sales/models/outlet_takings_line.rk +37 -0
  63. package/template/base/modules/outlets/models/outlet.rk +17 -0
  64. package/template/base/modules/payments/flows/payment_gateway_claim_created.rk +19 -0
  65. package/template/base/modules/payments/flows/payment_gateway_claim_submitted.rk +19 -0
  66. package/template/base/modules/payments/flows/payment_gateway_release.rk +12 -0
  67. package/template/base/modules/payments/models/gateway_ref_claim.rk +42 -0
  68. package/template/base/modules/payments/models/payment.rk +26 -1
  69. package/template/base/modules/payments/models/withholding.rk +3 -1
  70. package/template/base/modules/payments/module.rk +1 -1
  71. package/template/base/modules/procurement/flows/project_vendor_cost_on_cancel.rk +22 -0
  72. package/template/base/modules/procurement/flows/project_vendor_cost_on_submit.rk +17 -0
  73. package/template/base/modules/procurement/imports/opening_stock.rk +25 -0
  74. package/template/base/modules/procurement/models/goods_receipt.rk +1 -1
  75. package/template/base/modules/procurement/models/purchase_order.rk +15 -7
  76. package/template/base/modules/procurement/models/purchase_request.rk +11 -1
  77. package/template/base/modules/procurement/models/vendor_bill.rk +12 -1
  78. package/template/base/modules/procurement/module.rk +1 -1
  79. package/template/base/modules/projects/flows/milestone_back_on_acceptance_cancel.rk +15 -0
  80. package/template/base/modules/projects/flows/milestone_lock_on_update.rk +16 -0
  81. package/template/base/modules/projects/flows/milestone_ready_on_acceptance.rk +40 -0
  82. package/template/base/modules/projects/flows/milestone_scheduled_on_create.rk +14 -0
  83. package/template/base/modules/projects/flows/milestone_scheduled_on_update.rk +27 -0
  84. package/template/base/modules/projects/flows/project_expense_on_cancel.rk +21 -0
  85. package/template/base/modules/projects/flows/project_expense_on_submit.rk +16 -0
  86. package/template/base/modules/projects/flows/project_labor_on_cancel.rk +22 -0
  87. package/template/base/modules/projects/flows/project_labor_on_submit.rk +17 -0
  88. package/template/base/modules/projects/flows/project_terms_lock.rk +26 -0
  89. package/template/base/modules/projects/flows/vendor_bill_cancel_guard.rk +15 -0
  90. package/template/base/modules/projects/imports/billing_milestone.rk +20 -0
  91. package/template/base/modules/projects/models/assignment.rk +21 -1
  92. package/template/base/modules/projects/models/billing_milestone.rk +217 -0
  93. package/template/base/modules/projects/models/project.rk +76 -2
  94. package/template/base/modules/projects/models/project_expense.rk +119 -0
  95. package/template/base/modules/projects/models/project_guard.rk +27 -0
  96. package/template/base/modules/projects/models/project_ledger.rk +132 -0
  97. package/template/base/modules/projects/models/timesheet.rk +38 -3
  98. package/template/base/modules/projects/module.rk +1 -1
  99. package/template/base/modules/stock/flows/adjustment_value_backfill.rk +94 -0
  100. package/template/base/modules/stock/flows/adjustment_value_on_cancel.rk +19 -0
  101. package/template/base/modules/stock/flows/adjustment_value_on_submit.rk +17 -0
  102. package/template/base/modules/stock/models/recipe.rk +8 -0
  103. package/template/base/modules/stock/models/stock_adjustment.rk +1 -0
  104. package/template/base/modules/stock/models/stock_adjustment_value.rk +75 -0
  105. package/template/base/modules/stock/models/stock_balance.rk +3 -0
  106. package/template/base/modules/stock/models/stock_move.rk +6 -1
  107. package/template/base/modules/workforce/imports/worker_list.rk +16 -0
  108. package/template/base/modules/workforce/models/certification.rk +1 -2
  109. package/template/base/modules/workforce/models/worker.rk +22 -1
  110. package/template/demo/fixtures/demo.rk +2 -2
@@ -0,0 +1,20 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
2
+ # The opening item list of a new installation: one row per item, the same file for F&B materials and products and for
3
+ # services. SKU is required (it is the duplicate key and what the sales imports match on). Jenis is read without regard
4
+ # to case (Bahan baku, Produk jadi, Jasa; anything else is Barang). Units are matched by name (Kg, Liter, Pcs,
5
+ # Orang-hari...), so the units must exist first. Imports only create: a SKU already imported is skipped, prices are
6
+ # changed on the item itself.
7
+ name: item_list
8
+ label: {id: Daftar barang & harga, en: Item list}
9
+ model: item
10
+ source: csv
11
+ header_row: 1
12
+ key: [SKU]
13
+ map:
14
+ item_name: Nama barang
15
+ sku: SKU
16
+ kind: "=row['Jenis'].lowerAscii().trim() == 'bahan baku' ? 'material' : row['Jenis'].lowerAscii().trim() == 'produk jadi' ? 'product' : row['Jenis'].lowerAscii().trim() == 'jasa' ? 'service' : 'good'"
17
+ stock_uom: {value: Satuan, match: uom_name}
18
+ sales_uom: {value: Satuan, match: uom_name}
19
+ rate: Harga jual
20
+ standard_cost: Harga pokok
@@ -0,0 +1,25 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
2
+ # Juragan's item list template (one row per item or variant), the way a shop moves its POS item list or its Excel in.
3
+ # Headers: SKU, Barcode, Nama barang, Kategori, Grup varian, Varian, Satuan, Harga jual, Harga pokok, Penitip, Harga
4
+ # setor. Satuan, Kategori and Penitip (a vendor) must already exist, by name; empty cells leave the field empty. Imports only create: an SKU already imported is skipped (key), so an updated
5
+ # list adds the new items and leaves the old ones as they are. Columns are matched by name, so the order is free.
6
+ # Not checked against a real POS item export yet: Moka, Loyverse and majoo each name these columns differently.
7
+ name: item_master
8
+ label: {id: Daftar barang, en: Item list}
9
+ model: item
10
+ source: csv
11
+ header_row: 1
12
+ key: [SKU]
13
+ map:
14
+ sku: SKU
15
+ barcode: Barcode
16
+ item_name: Nama barang
17
+ kind: "='good'"
18
+ category: {value: Kategori, match: category_name}
19
+ variant_group: Grup varian
20
+ variant_label: Varian
21
+ stock_uom: {value: Satuan, match: uom_name}
22
+ rate: Harga jual
23
+ standard_cost: Harga pokok
24
+ consignor: {value: Penitip, match: vendor_name}
25
+ consignment_cost: Harga setor
@@ -9,7 +9,7 @@ permissions:
9
9
  - {role: finance_manager, read: true, create: true, write: true, print: true}
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
- - {role: head_office, read: true, create: true, write: true, print: true}
12
+ - {role: head_office, read: true, create: true, write: true, import: true, print: true}
13
13
  - {role: outlet_staff, read: true}
14
14
  - {role: sales_rep, read: true}
15
15
  fields:
@@ -23,6 +23,26 @@ fields:
23
23
  label: {id: SKU}
24
24
  in_list: true
25
25
  unique: true
26
+ # A shop scans or types the barcode (EAN-13 / PLU) printed on the pack; a POS export usually carries it as the SKU.
27
+ - name: barcode
28
+ type: data
29
+ label: {id: Barcode}
30
+ unique: true
31
+ - name: category
32
+ type: link
33
+ to: item_category
34
+ label: {id: Kategori}
35
+ in_list: true
36
+ # Variants are separate items (every Indonesian POS exports a variant as its own SKU). Items of one product share
37
+ # variant_group (e.g. KAOS-POLOS) and differ in variant_label (e.g. "M / Hitam"); no size x colour generator.
38
+ - name: variant_group
39
+ type: data
40
+ label: {id: Grup varian}
41
+ help: {id: 'Kode yang sama untuk semua varian satu produk, misalnya KAOS-POLOS'}
42
+ - name: variant_label
43
+ type: data
44
+ label: {id: Varian}
45
+ help: {id: 'Misalnya "M / Hitam" atau "600 ml"'}
26
46
  - name: kind
27
47
  type: select
28
48
  label: {id: Jenis}
@@ -55,6 +75,19 @@ fields:
55
75
  type: float
56
76
  label: {id: Stok}
57
77
  in_list: true
78
+ # Consignment in (barang titipan): the consignor still owns the goods; the shop pays consignment_cost per unit sold
79
+ # in the monthly settlement (module consignment). Empty consignor = the shop's own goods.
80
+ - name: consignor
81
+ type: link
82
+ to: vendor
83
+ label: {id: Penitip}
84
+ help: {id: 'Isi kalau barang ini titipan. Kosongkan untuk barang milik sendiri'}
85
+ depends_on: app_installed('consignment')
86
+ - name: consignment_cost
87
+ type: currency
88
+ label: {id: Harga setor titipan}
89
+ help: {id: 'Yang dibayar ke penitip per barang terjual'}
90
+ depends_on: app_installed('consignment') && consignor != ''
58
91
  - name: notes
59
92
  type: text
60
93
  label: {id: Catatan}
@@ -0,0 +1,26 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: item_category
3
+ label: {id: Kategori barang, en: Item category}
4
+ icon: stock
5
+ naming: KTG-{###}
6
+ title_field: category_name
7
+ # Flat list (no tree): shops group items as "Minuman", "Sembako", "Rokok". Margin and sales per category are read
8
+ # from the item's category.
9
+ permissions:
10
+ - {role: sales_manager, read: true, create: true, write: true, print: true}
11
+ - {role: finance_manager, read: true, create: true, write: true, print: true}
12
+ - {role: purchasing_manager, read: true, create: true, write: true, print: true}
13
+ - {role: project_admin, read: true, create: true, write: true, print: true}
14
+ - {role: head_office, read: true, create: true, write: true, delete: true, print: true}
15
+ - {role: outlet_staff, read: true}
16
+ - {role: sales_rep, read: true}
17
+ fields:
18
+ - name: category_name
19
+ type: data
20
+ label: {id: Nama kategori}
21
+ required: true
22
+ in_list: true
23
+ unique: true
24
+ - name: notes
25
+ type: text
26
+ label: {id: Catatan}
@@ -0,0 +1,36 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ name: consignment_bill
3
+ label: {id: Tagihan setoran titipan}
4
+ # Runs in the submitter's transaction (rangka-os #34). One live vendor_bill per consignor and bill_ref (month); only one
5
+ # settlement per consignor and month can be live (period_key), so:
6
+ # - no bill yet: a draft bill with one line per item sold (qty_sold x rate);
7
+ # - a draft bill left by a cancelled settlement of that month: its lines are replaced by this (amended) settlement's;
8
+ # - a submitted bill: nothing is created; head office is told to check it, so a payable is never written twice.
9
+ on: consignment_settlement.submitted
10
+ if: event.total > 0
11
+ steps:
12
+ - {find: vendor_bill, where: "vendor == event.consignor && bill_no == event.bill_ref && docstatus != 2", as: bill}
13
+ - create: vendor_bill
14
+ if: bill == null
15
+ set:
16
+ vendor: event.consignor
17
+ bill_no: event.bill_ref
18
+ bill_date: today()
19
+ items: "event.items.filter(i, i.qty_sold > 0).map(i, {'item': i.item, 'qty': i.qty_sold, 'rate': i.rate})"
20
+ as: created
21
+ - update: bill
22
+ if: bill != null && bill.docstatus == 0
23
+ set:
24
+ items: "event.items.filter(i, i.qty_sold > 0).map(i, {'item': i.item, 'qty': i.qty_sold, 'rate': i.rate})"
25
+ - notify: head_office
26
+ if: bill == null
27
+ channel: in_app
28
+ template: {id: 'Setoran titipan {event.name} jadi draf tagihan {created.name}, cek lalu ajukan'}
29
+ - notify: head_office
30
+ if: bill != null && bill.docstatus == 0
31
+ channel: in_app
32
+ template: {id: 'Draf tagihan {bill.name} diperbarui dari setoran titipan {event.name}'}
33
+ - notify: head_office
34
+ if: bill != null && bill.docstatus == 1
35
+ channel: in_app
36
+ template: {id: 'Tagihan {bill.name} untuk periode ini sudah diajukan. Batalkan dulu tagihan itu, lalu ajukan ulang setoran {event.name}'}
@@ -0,0 +1,14 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ name: consignment_bill_cancelled
3
+ label: {id: Setoran titipan dibatalkan}
4
+ # Runs in the canceller's transaction. While the month's bill is submitted the cancel is refused: the update step
5
+ # writes to a submitted vendor_bill, which the engine refuses, and that rolls the cancel back. Cancel (or pay back)
6
+ # the bill first, then the settlement; its amended copy then makes a new draft bill. A draft bill is left for the
7
+ # amended settlement to fill.
8
+ on: consignment_settlement.cancelled
9
+ steps:
10
+ - {find: vendor_bill, where: "vendor == event.consignor && bill_no == event.bill_ref && docstatus == 1", as: bill}
11
+ - update: bill
12
+ if: bill != null
13
+ set:
14
+ notes: "'Batalkan tagihan ini dulu sebelum setoran titipan ' + event.name + ' dibatalkan'"
@@ -0,0 +1,93 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: consignment_settlement
3
+ label: {id: Setoran titipan, en: Consignment settlement}
4
+ icon: invoice
5
+ is_submittable: true
6
+ naming: KNS-{YYYY}-{####}
7
+ title_field: consignor
8
+ # One consignor, one month, all outlets. Per item: received, sold and returned in the month, and what is left on the
9
+ # shelf; the shop owes qty_sold x rate. Submitting creates a draft vendor_bill for the consignor (flow consignment_bill),
10
+ # which head office checks, submits and pays. One settlement per consignor and month (period_key is unique; an amended
11
+ # copy carries amended_from, so a cancelled settlement can be amended), so two settlements can never bill one month.
12
+ # A settlement whose bill is submitted cannot be cancelled (flow consignment_bill_cancelled): cancel the bill first. qty_sold is typed from the "Titipan terjual" list of the retail dashboard;
13
+ # filling it from the stock moves needs a kernel hook (draft contract 0021, K-o).
14
+ # No delete for head office: deleting a cancelled settlement would free its month's key while its amended copy is
15
+ # live, and a second settlement of that month would then go unbilled. Only the owner may delete.
16
+ permissions:
17
+ - {role: head_office, read: true, create: true, write: true, submit: true, cancel: true, amend: true, export: true, print: true}
18
+ fields:
19
+ - name: consignor
20
+ type: link
21
+ to: vendor
22
+ label: {id: Penitip}
23
+ required: true
24
+ in_list: true
25
+ - name: month
26
+ type: data
27
+ label: {id: Bulan}
28
+ help: {id: 'Format TTTT-BB, misalnya 2026-10'}
29
+ required: true
30
+ in_list: true
31
+ - name: items
32
+ type: table
33
+ of: consignment_settlement_item
34
+ label: {id: Barang titipan}
35
+ min_rows: 1
36
+ - name: qty_sold_total
37
+ type: float
38
+ label: {id: Total terjual}
39
+ compute: items.map(i, i.qty_sold).sum()
40
+ - name: total
41
+ type: currency
42
+ label: {id: Nilai setor}
43
+ compute: items.map(i, i.amount).sum()
44
+ in_list: true
45
+ - name: notes
46
+ type: text
47
+ label: {id: Catatan}
48
+ # The bill number of this consignor and month: the flow keeps one live vendor_bill per bill_ref.
49
+ - name: bill_ref
50
+ type: data
51
+ label: {id: Nomor tagihan titipan}
52
+ compute: "'TTP/' + month"
53
+ in_list: true
54
+ - name: period_key
55
+ type: data
56
+ label: {id: Kunci periode}
57
+ compute: "consignor + '|' + month + (amended_from == '' ? '' : '|' + amended_from)"
58
+ unique: true
59
+ rules:
60
+ - name: month_format
61
+ on: save
62
+ check: "month.matches('^20[0-9]{2}-(0[1-9]|1[0-2])$')"
63
+ message: {id: 'Bulan ditulis TTTT-BB, misalnya 2026-10'}
64
+ - name: qty_not_negative
65
+ on: save
66
+ check: "items.map(i, i.qty_received < 0 || i.qty_sold < 0 || i.qty_returned < 0 ? 1 : 0).sum() == 0"
67
+ message: {id: Jumlah barang tidak boleh negatif}
68
+ - name: rate_for_sold_items
69
+ on: save
70
+ check: "items.map(i, i.qty_sold > 0 && i.rate <= 0 ? 1 : 0).sum() == 0"
71
+ message: {id: 'Harga setor wajib diisi untuk barang yang terjual'}
72
+ - name: sold_within_stock
73
+ on: save
74
+ check: "items.map(i, i.qty_left < 0 ? 1 : 0).sum() == 0"
75
+ message: {id: 'Terjual ditambah dikembalikan melebihi stok awal ditambah diterima'}
76
+ views:
77
+ list:
78
+ columns: [name, consignor, month, status, total, bill_ref]
79
+ filters: [consignor]
80
+ sort: -month
81
+ form:
82
+ layout:
83
+ - section: {id: Setoran titipan}
84
+ columns:
85
+ - [consignor, month]
86
+ - [bill_ref]
87
+ - section: {id: Barang titipan}
88
+ fields: [items]
89
+ - section: {id: Ringkasan}
90
+ columns:
91
+ - [qty_sold_total, total]
92
+ - section: {id: Catatan}
93
+ fields: [notes]
@@ -0,0 +1,37 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ name: consignment_settlement_item
3
+ is_child: true
4
+ fields:
5
+ - name: item
6
+ type: link
7
+ to: item
8
+ label: {id: Barang}
9
+ required: true
10
+ - name: qty_opening
11
+ type: float
12
+ label: {id: Stok awal periode}
13
+ default: '0'
14
+ - name: qty_received
15
+ type: float
16
+ label: {id: Diterima}
17
+ default: '0'
18
+ - name: qty_sold
19
+ type: float
20
+ label: {id: Terjual}
21
+ required: true
22
+ - name: qty_returned
23
+ type: float
24
+ label: {id: Dikembalikan}
25
+ default: '0'
26
+ - name: qty_left
27
+ type: float
28
+ label: {id: Sisa di rak}
29
+ compute: qty_opening + qty_received - qty_sold - qty_returned
30
+ - name: rate
31
+ type: currency
32
+ label: {id: Harga setor}
33
+ default: item.consignment_cost
34
+ - name: amount
35
+ type: currency
36
+ label: {id: Jumlah}
37
+ compute: round(qty_sold * rate)
@@ -0,0 +1,10 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
2
+ # Consignment in (barang titipan): a shop sells goods a supplier still owns and pays for what sold, usually monthly.
3
+ # The goods come in through goods_receipt from the consignor (stock moves, no payable: payables come only from
4
+ # vendor_bill); item.consignor and item.consignment_cost (catalogue) mark them. Unsold goods go back through
5
+ # stock_adjustment with reason consignment_return. The monthly settlement becomes a draft vendor_bill (flow
6
+ # consignment_bill), so it is paid like any other bill.
7
+ name: consignment
8
+ version: 1.0.0
9
+ title: {id: Konsinyasi, en: Consignment}
10
+ requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, catalogue: ^1.0, outlets: ^1.0, stock: ^1.0, procurement: ^1.0}
@@ -0,0 +1,17 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
2
+ # The opening customer list: one row per customer. WhatsApp numbers in +62 form, NPWP 16 digits (may be empty).
3
+ # Duplicates are detected against earlier imports only (contract 0012): a customer typed in by hand with the same name is
4
+ # not matched and would be created again; check the list before importing into an installation that is already in use.
5
+ name: customer_list
6
+ label: {id: Daftar pelanggan, en: Customer list}
7
+ model: customer
8
+ source: csv
9
+ header_row: 1
10
+ key: [Nama pelanggan]
11
+ map:
12
+ customer_name: Nama pelanggan
13
+ city: Kota
14
+ phone: WhatsApp
15
+ email: Email
16
+ payment_days: Tempo (hari)
17
+ npwp: NPWP
@@ -0,0 +1,16 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
2
+ # The opening supplier list: one row per supplier.
3
+ # Duplicates are detected against earlier imports only (contract 0012): a supplier typed in by hand with the same name is
4
+ # not matched and would be created again; check the list before importing into an installation that is already in use.
5
+ name: vendor_list
6
+ label: {id: Daftar pemasok, en: Supplier list}
7
+ model: vendor
8
+ source: csv
9
+ header_row: 1
10
+ key: [Nama pemasok]
11
+ map:
12
+ vendor_name: Nama pemasok
13
+ city: Kota
14
+ phone: WhatsApp
15
+ payment_days: Tempo (hari)
16
+ npwp: NPWP
@@ -0,0 +1,12 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ # Morning list of invoices to chase: submitted, money still owed, due today or earlier. Goes to the owner today
3
+ # (notify writes the audit log and email); the WhatsApp reminder to the customer waits for the connector runtime.
4
+ name: invoice_due_digest
5
+ label: {id: Daftar tagih pagi, en: Morning collection list}
6
+ schedule: 0 8 * * 1-6
7
+ steps:
8
+ - {find_all: sales_invoice, where: "docstatus == 1 && outstanding > 0 && due_date <= today()", sort: due_date, as: due}
9
+ - if: size(due) > 0
10
+ notify: owner
11
+ channel: email
12
+ template: {id: 'Tagih hari ini: {size(due)} faktur jatuh tempo, sisa Rp {due.map(i, i.outstanding).sum()}. Cetak "Pesan tagihan WA" di tiap faktur.'}
@@ -0,0 +1,23 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ name: milestone_invoiced
3
+ label: {id: Termin ditandai sudah ditagih}
4
+ # Runs inside the invoice's submit, as the person submitting it: the milestone the invoice bills becomes invoiced and
5
+ # points at the invoice, so the schedule shows what is billed and milestone_not_invoiced refuses a second invoice. A
6
+ # retainer month already invoiced on another milestone of the project (also one from before retainer_key) sets
7
+ # month_billed, and rule month_not_billed refuses the submit.
8
+ on: sales_invoice.submitted
9
+ if: event.billing_milestone != ''
10
+ steps:
11
+ - {find: billing_milestone, where: name == event.billing_milestone, as: ms}
12
+ - if: ms != null && ms.kind == 'retainer'
13
+ find_all: billing_milestone
14
+ where: project == ms.project && kind == 'retainer' && period_from == ms.period_from && state == 'invoiced' && name != ms.name
15
+ limit: 1
16
+ as: same_month
17
+ - if: ms != null
18
+ update: ms
19
+ set:
20
+ state: "'invoiced'"
21
+ sales_invoice: event.name
22
+ over_billed: ms.amount < event.dpp
23
+ month_billed: ms.kind == 'retainer' && size(same_month) > 0
@@ -0,0 +1,19 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ name: milestone_reopened
3
+ label: {id: Termin dibuka lagi saat faktur dibatalkan}
4
+ # A cancelled invoice gives its milestone back: ready to bill again when nothing else holds it (a dated milestone, or
5
+ # an acceptance milestone whose report is still live), planned when its report was cancelled too.
6
+ on: sales_invoice.cancelled
7
+ if: event.billing_milestone != ''
8
+ steps:
9
+ - {find: billing_milestone, where: name == event.billing_milestone && sales_invoice == event.name, as: ms}
10
+ - if: ms != null && ms.acceptance != ''
11
+ find: acceptance
12
+ where: name == ms.acceptance
13
+ as: ba
14
+ - if: ms != null
15
+ update: ms
16
+ set:
17
+ state: "ms.trigger == 'acceptance' && (ms.acceptance == '' || ba == null || ba.docstatus != 1) ? 'planned' : 'ready'"
18
+ sales_invoice: "''"
19
+ bill_token: event.name
@@ -0,0 +1,16 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ name: project_billed_on_cancel
3
+ label: {id: Tagihan proyek dihitung ulang saat batal}
4
+ # Inside the invoice's cancel. billed_amount is recomputed from the project's submitted invoices (retention releases excluded), so invoices
5
+ # from before billed_amount existed count too; the project's rule billing_within_contract then refuses the save that
6
+ # would bill the project above its contract.
7
+ on: sales_invoice.cancelled
8
+ if: event.project != ''
9
+ steps:
10
+ - find_all: sales_invoice
11
+ where: project == event.project && docstatus == 1 && kind != 'retention'
12
+ as: invs
13
+ - {find: project, where: name == event.project, as: prj}
14
+ - update: prj
15
+ set:
16
+ billed_amount: "size(invs) == 0 ? 0 : invs.map(i, i.dpp).sum()"
@@ -0,0 +1,16 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ name: project_billed_on_submit
3
+ label: {id: Tagihan proyek dihitung ulang}
4
+ # Inside the invoice's submit. billed_amount is recomputed from the project's submitted invoices (retention releases excluded), so invoices
5
+ # from before billed_amount existed count too; the project's rule billing_within_contract then refuses the save that
6
+ # would bill the project above its contract.
7
+ on: sales_invoice.submitted
8
+ if: event.project != ''
9
+ steps:
10
+ - find_all: sales_invoice
11
+ where: project == event.project && docstatus == 1 && kind != 'retention'
12
+ as: invs
13
+ - {find: project, where: name == event.project, as: prj}
14
+ - update: prj
15
+ set:
16
+ billed_amount: "size(invs) == 0 ? 0 : invs.map(i, i.dpp).sum()"
@@ -0,0 +1,22 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ name: project_revenue_on_cancel
3
+ label: {id: Pendapatan proyek batal}
4
+ # Project ledger row (projects): a cancel writes the opposite row on the document's date, only when the document has a + row (documents submitted before the ledger existed have none).
5
+ on: sales_invoice.cancelled
6
+ if: event.project != '' && event.kind != 'retention'
7
+ steps:
8
+ - find: project_ledger
9
+ where: source_name == event.name && kind == 'revenue' && entry == 'post'
10
+ as: orig
11
+ - if: orig != null
12
+ create: project_ledger
13
+ set:
14
+ project: event.project
15
+ posting_date: orig.posting_date
16
+ entry: "'reverse'"
17
+ reverses: orig.name
18
+ kind: "'revenue'"
19
+ source_model: event.model
20
+ source_name: event.name
21
+ sales_invoice: event.name
22
+ amount: "0 - orig.amount"
@@ -0,0 +1,17 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
2
+ name: project_revenue_on_submit
3
+ label: {id: Pendapatan proyek dari faktur}
4
+ # Project ledger row (projects): the sum of a project's rows is its margin.
5
+ on: sales_invoice.submitted
6
+ if: event.project != '' && event.kind != 'retention'
7
+ steps:
8
+ - create: project_ledger
9
+ set:
10
+ project: event.project
11
+ posting_date: event.posting_date
12
+ entry: "'post'"
13
+ kind: "'revenue'"
14
+ source_model: event.model
15
+ source_name: event.name
16
+ sales_invoice: event.name
17
+ amount: "event.dpp"
@@ -0,0 +1,83 @@
1
+ # yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
2
+ # One row per reminder sent for an invoice (WhatsApp from the owner's phone today; the WhatsApp connector later).
3
+ # A submitted invoice is immutable, so "who was reminded when" lives here, not on sales_invoice.
4
+ name: invoice_reminder
5
+ label: {id: Pengingat tagihan, en: Invoice reminder}
6
+ icon: bell
7
+ naming: REM-{YYYY}-{#####}
8
+ title_field: sales_invoice
9
+ permissions:
10
+ - {role: finance_manager, read: true, create: true, write: true, delete: true, export: true}
11
+ - {role: sales_manager, read: true, create: true, write: true, delete: true, export: true}
12
+ - {role: sales_rep, read: true, create: true}
13
+ fields:
14
+ - name: sales_invoice
15
+ type: link
16
+ to: sales_invoice
17
+ label: {id: Faktur}
18
+ required: true
19
+ in_list: true
20
+ peek: [customer, due_date, outstanding]
21
+ - name: customer
22
+ type: link
23
+ to: customer
24
+ label: {id: Pelanggan}
25
+ default: sales_invoice.customer
26
+ in_list: true
27
+ - name: reminded_on
28
+ type: date
29
+ label: {id: Tanggal}
30
+ default: today()
31
+ required: true
32
+ in_list: true
33
+ - name: channel
34
+ type: select
35
+ label: {id: Lewat}
36
+ default: "'whatsapp'"
37
+ required: true
38
+ chip: true
39
+ in_list: true
40
+ options:
41
+ - {value: whatsapp, label: {id: WhatsApp}}
42
+ - {value: phone, label: {id: Telepon}}
43
+ - {value: email, label: {id: Email}}
44
+ - {value: visit, label: {id: Kunjungan}}
45
+ # Names match the WhatsApp Business templates of rangka-connectors (lowercase snake_case, as Meta requires).
46
+ - name: template
47
+ type: select
48
+ label: {id: Jenis pesan}
49
+ default: "sales_invoice.due_date < today() ? 'pengingat_jatuh_tempo' : 'tagihan_terbit'"
50
+ in_list: true
51
+ options:
52
+ - {value: tagihan_terbit, label: {id: Tagihan terbit}}
53
+ - {value: pengingat_jatuh_tempo, label: {id: Pengingat jatuh tempo}}
54
+ - {value: terima_kasih_lunas, label: {id: 'Terima kasih, sudah lunas'}}
55
+ - name: outstanding
56
+ type: currency
57
+ label: {id: Sisa tagihan saat itu}
58
+ default: sales_invoice.outstanding
59
+ read_only: true
60
+ in_list: true
61
+ - name: promised_date
62
+ type: date
63
+ label: {id: Janji bayar}
64
+ - name: note
65
+ type: text
66
+ label: {id: Catatan}
67
+ rules:
68
+ - name: invoice_submitted
69
+ on: save
70
+ check: sales_invoice.docstatus == 1
71
+ message: {id: Hanya faktur yang sudah diajukan yang bisa ditagih}
72
+ views:
73
+ list:
74
+ columns: [name, sales_invoice, customer, reminded_on, channel, template, outstanding, promised_date]
75
+ sort: -reminded_on
76
+ form:
77
+ layout:
78
+ - section: {id: Pengingat}
79
+ columns:
80
+ - [sales_invoice, customer, outstanding]
81
+ - [reminded_on, channel, template, promised_date]
82
+ - section: {id: Catatan}
83
+ fields: [note]