@rangka-os/create 0.5.0-alpha.6 → 0.5.0-alpha.7
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.
- package/package.json +1 -1
- package/template/base/apps/grosir_distribusi/app.rk +48 -0
- package/template/base/apps/grosir_distribusi/dashboards/grosir_ar.rk +62 -0
- package/template/base/apps/grosir_distribusi/dashboards/grosir_overview.rk +85 -0
- package/template/base/apps/produksi_pabrik/app.rk +46 -0
- package/template/base/apps/produksi_pabrik/dashboards/produksi_overview.rk +96 -0
- package/template/base/apps/produksi_pabrik/dashboards/produksi_upah.rk +39 -0
- package/template/base/modules/catalogue/models/item.rk +22 -0
- package/template/base/modules/catalogue/models/item_category.rk +1 -0
- package/template/base/modules/catalogue/models/uom.rk +1 -0
- package/template/base/modules/catalogue/module.rk +2 -1
- package/template/base/modules/contacts/models/customer.rk +58 -1
- package/template/base/modules/contacts/module.rk +1 -1
- package/template/base/modules/delivery/flows/delivery_cancel_guard.rk +18 -0
- package/template/base/modules/delivery/flows/fulfilment_on_delivery_cancelled.rk +21 -0
- package/template/base/modules/delivery/flows/fulfilment_on_delivery_submitted.rk +21 -0
- package/template/base/modules/delivery/flows/fulfilment_on_invoice_cancelled.rk +22 -0
- package/template/base/modules/delivery/flows/fulfilment_on_invoice_submitted.rk +22 -0
- package/template/base/modules/delivery/flows/fulfilment_on_order_created.rk +18 -0
- package/template/base/modules/delivery/flows/fulfilment_on_order_submitted.rk +16 -0
- package/template/base/modules/delivery/flows/fulfilment_on_order_updated.rk +19 -0
- package/template/base/modules/delivery/flows/fulfilment_on_return_cancelled.rk +16 -0
- package/template/base/modules/delivery/flows/fulfilment_on_return_submitted.rk +16 -0
- package/template/base/modules/delivery/flows/invoice_qty_from_deliveries.rk +20 -0
- package/template/base/modules/delivery/flows/order_cancel_guard.rk +10 -0
- package/template/base/modules/delivery/flows/return_cancel_guard.rk +11 -0
- package/template/base/modules/delivery/flows/return_credit_on_payment_cancelled.rk +11 -0
- package/template/base/modules/delivery/flows/return_credit_on_payment_submitted.rk +21 -0
- package/template/base/modules/delivery/flows/return_credit_on_return_cancelled.rk +11 -0
- package/template/base/modules/delivery/flows/return_credit_on_return_submitted.rk +10 -0
- package/template/base/modules/delivery/models/delivery_guard.rk +48 -0
- package/template/base/modules/delivery/models/delivery_note.rk +94 -0
- package/template/base/modules/delivery/models/delivery_note_item.rk +9 -0
- package/template/base/modules/delivery/models/order_fulfilment.rk +27 -0
- package/template/base/modules/delivery/models/order_fulfilment_item.rk +10 -0
- package/template/base/modules/delivery/models/return_credit.rk +23 -0
- package/template/base/modules/delivery/models/sales_return.rk +87 -0
- package/template/base/modules/delivery/models/sales_return_item.rk +16 -0
- package/template/base/modules/delivery/module.rk +11 -0
- package/template/base/modules/distribution/flows/credit_on_invoice_cancelled.rk +17 -0
- package/template/base/modules/distribution/flows/credit_on_invoice_submitted.rk +17 -0
- package/template/base/modules/distribution/flows/credit_on_order_cancelled.rk +17 -0
- package/template/base/modules/distribution/flows/credit_on_order_submitted.rk +17 -0
- package/template/base/modules/distribution/flows/credit_on_payment_cancelled.rk +17 -0
- package/template/base/modules/distribution/flows/credit_on_payment_submitted.rk +17 -0
- package/template/base/modules/distribution/flows/giro_bounced.rk +20 -0
- package/template/base/modules/distribution/flows/giro_from_payment.rk +21 -0
- package/template/base/modules/distribution/flows/order_tier_pricing_created.rk +17 -0
- package/template/base/modules/distribution/flows/order_tier_pricing_updated.rk +17 -0
- package/template/base/modules/distribution/models/giro.rk +79 -0
- package/template/base/modules/distribution/module.rk +9 -0
- package/template/base/modules/invoicing/models/sales_invoice.rk +16 -1
- package/template/base/modules/invoicing/module.rk +2 -2
- package/template/base/modules/orders/models/customer_order.rk +80 -2
- package/template/base/modules/orders/models/customer_order_item.rk +19 -0
- package/template/base/modules/orders/module.rk +2 -2
- package/template/base/modules/outlets/models/outlet.rk +1 -0
- package/template/base/modules/outlets/module.rk +1 -1
- package/template/base/modules/payments/models/payment.rk +34 -1
- package/template/base/modules/payments/module.rk +2 -2
- package/template/base/modules/production/flows/batch_cancel_guard.rk +12 -0
- package/template/base/modules/production/flows/batch_from_bom.rk +19 -0
- package/template/base/modules/production/flows/wage_sheet_on_batch_cancelled.rk +14 -0
- package/template/base/modules/production/flows/wage_sheet_on_batch_submitted.rk +12 -0
- package/template/base/modules/production/flows/work_order_materials_created.rk +20 -0
- package/template/base/modules/production/flows/work_order_materials_updated.rk +20 -0
- package/template/base/modules/production/models/bom.rk +67 -0
- package/template/base/modules/production/models/bom_byproduct.rk +7 -0
- package/template/base/modules/production/models/bom_line.rk +11 -0
- package/template/base/modules/production/models/production_batch.rk +149 -0
- package/template/base/modules/production/models/production_guard.rk +23 -0
- package/template/base/modules/production/models/production_labour.rk +10 -0
- package/template/base/modules/production/models/production_material.rk +8 -0
- package/template/base/modules/production/models/production_output.rk +8 -0
- package/template/base/modules/production/models/production_stage.rk +19 -0
- package/template/base/modules/production/models/wage_line.rk +11 -0
- package/template/base/modules/production/models/wage_sheet.rk +28 -0
- package/template/base/modules/production/models/work_order.rk +63 -0
- package/template/base/modules/production/models/work_order_material.rk +8 -0
- package/template/base/modules/production/module.rk +12 -0
- package/template/base/modules/stock/models/stock_move.rk +4 -0
- package/template/base/modules/stock/module.rk +1 -1
- package/template/base/modules/users/models/user.rk +1 -0
- package/template/base/modules/users/module.rk +1 -1
- package/template/base/modules/users/roles/field_sales.rk +7 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# Bill of materials (resep produksi) for output_qty of a product. A line may be a semi-finished item that has its own
|
|
3
|
+
# BOM (item.default_bom): its unit cost is that BOM's unit_cost, so the cost rolls up any number of levels
|
|
4
|
+
# (multi-level). Each level is made with its own work order. By-products take a share of the material cost.
|
|
5
|
+
name: bom
|
|
6
|
+
label: {id: Resep produksi (BOM), en: Bill of materials}
|
|
7
|
+
icon: stock
|
|
8
|
+
naming: BOM-{####}
|
|
9
|
+
title_field: bom_name
|
|
10
|
+
permissions:
|
|
11
|
+
- {role: head_office, read: true, create: true, write: true, delete: true, export: true, print: true}
|
|
12
|
+
- {role: outlet_staff, read: true, print: true}
|
|
13
|
+
fields:
|
|
14
|
+
- {name: bom_name, type: data, label: {id: Nama resep}, required: true, in_list: true}
|
|
15
|
+
- {name: item, type: link, to: item, label: {id: Produk}, required: true, in_list: true}
|
|
16
|
+
- {name: output_qty, type: float, label: {id: Hasil standar per batch}, default: '1', required: true, in_list: true}
|
|
17
|
+
- {name: uom, type: link, to: uom, label: {id: Satuan hasil}, default: item.stock_uom}
|
|
18
|
+
- {name: yield_percent, type: float, label: {id: Rendemen standar (%)}, default: '100', help: {id: Hasil baik dibanding bahan yang masuk}}
|
|
19
|
+
- {name: active, type: check, label: {id: Aktif}, default: 'true', in_list: true}
|
|
20
|
+
- {name: lines, type: table, of: bom_line, label: {id: Bahan}, min_rows: 1}
|
|
21
|
+
- {name: byproducts, type: table, of: bom_byproduct, label: {id: Produk sampingan}}
|
|
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()"}
|
|
25
|
+
- {name: byproduct_share, type: float, label: {id: Porsi produk sampingan (%)}, compute: "byproducts.map(b, b.cost_share).sum()"}
|
|
26
|
+
- name: unit_cost
|
|
27
|
+
type: currency
|
|
28
|
+
label: {id: HPP standar per satuan}
|
|
29
|
+
compute: "output_qty > 0 ? round(material_cost * (100 - byproduct_share) / 100 / output_qty) + labour_per_unit + overhead_per_unit : 0"
|
|
30
|
+
in_list: true
|
|
31
|
+
- {name: notes, type: text, label: {id: Catatan}}
|
|
32
|
+
rules:
|
|
33
|
+
- name: output_positive
|
|
34
|
+
on: save
|
|
35
|
+
check: output_qty > 0
|
|
36
|
+
message: {id: Hasil standar harus lebih dari 0}
|
|
37
|
+
- name: not_itself
|
|
38
|
+
on: save
|
|
39
|
+
check: "lines.map(l, l.item == item ? 1 : 0).sum() == 0"
|
|
40
|
+
message: {id: Produk tidak boleh menjadi bahannya sendiri}
|
|
41
|
+
- name: share_below_100
|
|
42
|
+
on: save
|
|
43
|
+
check: byproduct_share < 100
|
|
44
|
+
message: {id: Porsi produk sampingan harus di bawah 100%}
|
|
45
|
+
- name: qty_positive
|
|
46
|
+
on: save
|
|
47
|
+
check: "lines.map(l, l.qty <= 0 ? 1 : 0).sum() == 0"
|
|
48
|
+
message: {id: Jumlah bahan harus lebih dari 0}
|
|
49
|
+
views:
|
|
50
|
+
list:
|
|
51
|
+
columns: [name, bom_name, item, output_qty, unit_cost, active]
|
|
52
|
+
form:
|
|
53
|
+
layout:
|
|
54
|
+
- section: {id: Resep}
|
|
55
|
+
columns:
|
|
56
|
+
- [bom_name, item, active]
|
|
57
|
+
- [output_qty, uom, yield_percent]
|
|
58
|
+
- section: {id: Bahan}
|
|
59
|
+
fields: [lines]
|
|
60
|
+
- section: {id: Produk sampingan}
|
|
61
|
+
fields: [byproducts]
|
|
62
|
+
- section: {id: Biaya standar}
|
|
63
|
+
columns:
|
|
64
|
+
- [material_cost, labour_per_unit, overhead_per_unit]
|
|
65
|
+
- [byproduct_share, unit_cost]
|
|
66
|
+
- section: {id: Catatan}
|
|
67
|
+
fields: [notes]
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: bom_byproduct
|
|
3
|
+
is_child: true
|
|
4
|
+
fields:
|
|
5
|
+
- {name: item, type: link, to: item, label: {id: Produk sampingan}, required: true}
|
|
6
|
+
- {name: qty, type: float, label: {id: Qty per batch}, default: '1'}
|
|
7
|
+
- {name: cost_share, type: float, label: {id: Porsi biaya bahan (%)}, default: '0'}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: bom_line
|
|
3
|
+
is_child: true
|
|
4
|
+
fields:
|
|
5
|
+
- {name: item, type: link, to: item, label: {id: Bahan}, required: true}
|
|
6
|
+
- {name: qty, type: float, label: {id: Qty}, default: '1'}
|
|
7
|
+
- {name: uom, type: link, to: uom, label: {id: Satuan}, default: item.stock_uom}
|
|
8
|
+
- {name: semi_finished, type: check, label: {id: Setengah jadi}, compute: "item.default_bom != ''"}
|
|
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)}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# Hasil produksi per batch. The batch number is the production code printed on the pack; the expiry date follows the
|
|
3
|
+
# product's shelf life. Submit takes the materials out of the production outlet at their moving average and puts
|
|
4
|
+
# the outputs into the finished-goods outlet at the value of those materials, split by cost_share (contract 0021,
|
|
5
|
+
# K-o). The actual cost (HPP) of the batch adds the piece-rate wages and the overhead rate to the material cost; the
|
|
6
|
+
# stock value holds the material cost only until K-r. Cancel reverses the stock (stock.reverse_moves).
|
|
7
|
+
name: production_batch
|
|
8
|
+
label: {id: Hasil produksi (batch), en: Production batch}
|
|
9
|
+
icon: stock
|
|
10
|
+
is_submittable: true
|
|
11
|
+
naming: BATCH-{YY}{MM}-{####}
|
|
12
|
+
title_field: item
|
|
13
|
+
on_submit: [stock.post_moves]
|
|
14
|
+
on_cancel: [stock.reverse_moves]
|
|
15
|
+
permissions:
|
|
16
|
+
- {role: head_office, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
17
|
+
- {role: outlet_staff, read: true, create: true, write: true, submit: true, print: true}
|
|
18
|
+
fields:
|
|
19
|
+
- {name: work_order, type: link, to: work_order, label: {id: SPK}, required: true, in_list: true, peek: [qty, due_date]}
|
|
20
|
+
- {name: item, type: link, to: item, label: {id: Produk}, default: work_order.item, read_only: true, in_list: true}
|
|
21
|
+
- {name: bom, type: link, to: bom, label: {id: Resep (BOM)}, default: work_order.bom, read_only: true}
|
|
22
|
+
- {name: outlet, type: link, to: outlet, label: {id: Tempat produksi (bahan keluar)}, default: work_order.outlet, required: true}
|
|
23
|
+
- {name: output_outlet, type: link, to: outlet, label: {id: Gudang barang jadi}, required: true}
|
|
24
|
+
- {name: production_date, type: date, label: {id: Tanggal produksi}, default: today(), required: true, in_list: true}
|
|
25
|
+
- {name: shelf_life_days, type: int, label: {id: Umur simpan (hari)}, default: item.shelf_life_days}
|
|
26
|
+
- name: expiry_date
|
|
27
|
+
type: date
|
|
28
|
+
label: {id: Kedaluwarsa}
|
|
29
|
+
compute: "shelf_life_days > 0 ? production_date + duration(shelf_life_days) : ''"
|
|
30
|
+
in_list: true
|
|
31
|
+
# the SPK's qty, not typed on the batch: output, materials and wages are checked against it
|
|
32
|
+
- {name: planned_qty, type: float, label: {id: Qty rencana}, default: work_order.qty, read_only: true}
|
|
33
|
+
# no min_rows: a batch created empty is drafted from its BOM by the flow batch_from_bom (rules check at submit)
|
|
34
|
+
- {name: materials, type: table, of: production_material, label: {id: Bahan terpakai}}
|
|
35
|
+
- {name: outputs, type: table, of: production_output, label: {id: Hasil}}
|
|
36
|
+
- {name: reject_qty, type: float, label: {id: Qty reject}}
|
|
37
|
+
- {name: labour, type: table, of: production_labour, label: {id: Upah borongan}}
|
|
38
|
+
- {name: good_qty, type: float, label: {id: Hasil baik (produk utama)}, compute: "outputs.map(o, o.item == item ? o.qty : 0).sum()", in_list: true}
|
|
39
|
+
- {name: yield_percent, type: float, label: {id: Rendemen aktual (%)}, compute: "planned_qty > 0 ? round(good_qty * 10000 / planned_qty) / 100 : 0"}
|
|
40
|
+
- {name: share_total, type: float, label: {id: Total porsi biaya (%)}, compute: "outputs.map(o, o.cost_share).sum()"}
|
|
41
|
+
- {name: main_share, type: float, label: {id: Porsi biaya produk utama (%)}, compute: "outputs.map(o, o.item == item ? o.cost_share : 0).sum()"}
|
|
42
|
+
- {name: material_cost, type: currency, label: {id: Biaya bahan (aktual)}, read_only: true}
|
|
43
|
+
- {name: labour_cost, type: currency, label: {id: Upah borongan}, compute: "labour.map(l, l.amount).sum()"}
|
|
44
|
+
- {name: overhead_rate, type: currency, label: {id: Overhead per satuan}, default: bom.overhead_per_unit}
|
|
45
|
+
- {name: overhead_cost, type: currency, label: {id: Overhead}, compute: round(good_qty * overhead_rate)}
|
|
46
|
+
# The product's share of the materials, plus all wages and overhead (by-products carry only their material share).
|
|
47
|
+
- name: hpp_total
|
|
48
|
+
type: currency
|
|
49
|
+
label: {id: HPP batch (produk utama)}
|
|
50
|
+
compute: "round(material_cost * main_share / 100) + labour_cost + overhead_cost"
|
|
51
|
+
in_list: true
|
|
52
|
+
- {name: hpp_per_unit, type: currency, label: {id: HPP per satuan}, compute: "good_qty > 0 ? round(hpp_total / good_qty) : 0", in_list: true}
|
|
53
|
+
- {name: standard_unit_cost, type: currency, label: {id: HPP standar per satuan}, default: bom.unit_cost, read_only: true}
|
|
54
|
+
- {name: notes, type: text, label: {id: Catatan}}
|
|
55
|
+
stock:
|
|
56
|
+
date: production_date
|
|
57
|
+
moves:
|
|
58
|
+
- {lines: materials, out: outlet, reason: production_out, cogs: cogs}
|
|
59
|
+
- {lines: outputs, in: output_outlet, reason: production_in, cost: {consumed: true, split: cost_share}}
|
|
60
|
+
cogs_total: material_cost
|
|
61
|
+
# Deviations from the plan wait for head office: materials that are not in the BOM, or more good output than 110% of
|
|
62
|
+
# the planned qty (a batch puts stock in at the value of what it took out, so an inflated output dilutes the cost).
|
|
63
|
+
approvals:
|
|
64
|
+
- name: material_outside_bom
|
|
65
|
+
on: submit
|
|
66
|
+
when: "materials.map(m, bom.lines.map(b, b.item == m.item ? 1 : 0).sum() > 0 ? 0 : 1).sum() > 0"
|
|
67
|
+
approvers: [head_office]
|
|
68
|
+
label: {id: Bahan di luar resep, en: Material not in the BOM}
|
|
69
|
+
# materials per BOM line against the recipe scaled to the good output: under 90% (output inflated against what was
|
|
70
|
+
# used, so the stock comes in too cheap) or over 120% (waste, or materials booked to the wrong batch)
|
|
71
|
+
- name: material_off_bom
|
|
72
|
+
on: submit
|
|
73
|
+
when: "good_qty > 0 && bom.output_qty > 0 && bom.lines.map(b, materials.map(m, m.item == b.item ? m.qty : 0).sum() < b.qty * good_qty / bom.output_qty * 0.9 || materials.map(m, m.item == b.item ? m.qty : 0).sum() > b.qty * good_qty / bom.output_qty * 1.2 ? 1 : 0).sum() > 0"
|
|
74
|
+
approvers: [head_office]
|
|
75
|
+
label: {id: Pemakaian bahan menyimpang dari resep, en: Materials off the BOM}
|
|
76
|
+
# wages above the BOM's standard piece cost for the good output (+10%)
|
|
77
|
+
- name: labour_above_standard
|
|
78
|
+
on: submit
|
|
79
|
+
when: labour_cost > round(bom.labour_per_unit * good_qty * 1.1)
|
|
80
|
+
approvers: [head_office]
|
|
81
|
+
label: {id: Upah borongan di atas standar, en: Piece-rate wages above standard}
|
|
82
|
+
# outputs against the BOM: the product's cost share is 100% less the by-products', each by-product keeps its share and
|
|
83
|
+
# at most 120% of its standard qty for the good output (a share or qty moved between outputs shifts stock value)
|
|
84
|
+
- name: output_off_bom
|
|
85
|
+
on: submit
|
|
86
|
+
when: "main_share < 100 - bom.byproduct_share - 0.005 || main_share > 100 - bom.byproduct_share + 0.005 || bom.byproducts.map(b, outputs.map(o, o.item == b.item ? o.cost_share : 0).sum() < b.cost_share - 0.005 || outputs.map(o, o.item == b.item ? o.cost_share : 0).sum() > b.cost_share + 0.005 || (bom.output_qty > 0 && outputs.map(o, o.item == b.item ? o.qty : 0).sum() > b.qty * good_qty / bom.output_qty * 1.2) ? 1 : 0).sum() > 0"
|
|
87
|
+
approvers: [head_office]
|
|
88
|
+
label: {id: Hasil atau porsi biaya menyimpang dari resep, en: Outputs off the BOM}
|
|
89
|
+
- name: over_planned_output
|
|
90
|
+
on: submit
|
|
91
|
+
when: good_qty > planned_qty * 1.1
|
|
92
|
+
approvers: [head_office]
|
|
93
|
+
label: {id: Hasil melebihi rencana, en: Output above plan}
|
|
94
|
+
rules:
|
|
95
|
+
- name: outputs_of_bom
|
|
96
|
+
on: save
|
|
97
|
+
check: "outputs.map(o, o.item == item || bom.byproducts.map(b, b.item == o.item ? 1 : 0).sum() > 0 ? 0 : 1).sum() == 0"
|
|
98
|
+
message: {id: Hasil hanya produk SPK atau produk sampingan resepnya}
|
|
99
|
+
- name: output_outlet_of_staff
|
|
100
|
+
on: save
|
|
101
|
+
check: "!('outlet_staff' in user.roles) || output_outlet in user.outlets"
|
|
102
|
+
message: {id: Gudang barang jadi harus outlet tempat kamu bekerja}
|
|
103
|
+
- name: work_order_released
|
|
104
|
+
on: save
|
|
105
|
+
check: work_order.docstatus == 1 && item == work_order.item && bom == work_order.bom && planned_qty == work_order.qty
|
|
106
|
+
message: {id: 'Batch hanya untuk SPK yang sudah dirilis (diajukan); kalau SPK-nya diganti, buat batch baru'}
|
|
107
|
+
- name: has_lines
|
|
108
|
+
on: submit
|
|
109
|
+
check: size(materials) > 0 && size(outputs) > 0
|
|
110
|
+
message: {id: Isi bahan terpakai dan hasil}
|
|
111
|
+
- name: shares_add_up
|
|
112
|
+
on: save
|
|
113
|
+
check: "size(outputs) == 0 || (share_total > 99.995 && share_total < 100.005)"
|
|
114
|
+
message: {id: Porsi biaya semua hasil harus berjumlah 100%}
|
|
115
|
+
- name: main_product_out
|
|
116
|
+
on: submit
|
|
117
|
+
check: good_qty > 0
|
|
118
|
+
message: {id: Isi hasil baik produk utama}
|
|
119
|
+
- name: qty_positive
|
|
120
|
+
on: save
|
|
121
|
+
check: "materials.map(m, m.qty <= 0 ? 1 : 0).sum() + outputs.map(o, o.qty <= 0 ? 1 : 0).sum() + labour.map(l, l.qty <= 0 ? 1 : 0).sum() == 0"
|
|
122
|
+
message: {id: 'Jumlah bahan, hasil dan upah harus lebih dari 0'}
|
|
123
|
+
- name: reject_not_negative
|
|
124
|
+
on: save
|
|
125
|
+
check: reject_qty >= 0
|
|
126
|
+
message: {id: Qty reject tidak boleh minus}
|
|
127
|
+
views:
|
|
128
|
+
list:
|
|
129
|
+
columns: [name, production_date, item, good_qty, yield_percent, hpp_per_unit, expiry_date, status]
|
|
130
|
+
filters: [item, outlet, work_order]
|
|
131
|
+
sort: -production_date
|
|
132
|
+
form:
|
|
133
|
+
layout:
|
|
134
|
+
- section: {id: Batch}
|
|
135
|
+
columns:
|
|
136
|
+
- [work_order, item, bom, planned_qty]
|
|
137
|
+
- [production_date, shelf_life_days, expiry_date, outlet, output_outlet]
|
|
138
|
+
- section: {id: Bahan terpakai}
|
|
139
|
+
fields: [materials]
|
|
140
|
+
- section: {id: Hasil}
|
|
141
|
+
fields: [outputs, reject_qty]
|
|
142
|
+
- section: {id: Upah borongan}
|
|
143
|
+
fields: [labour]
|
|
144
|
+
- section: {id: HPP aktual}
|
|
145
|
+
columns:
|
|
146
|
+
- [material_cost, labour_cost, overhead_rate, overhead_cost]
|
|
147
|
+
- [good_qty, yield_percent, hpp_total, hpp_per_unit, standard_unit_cost]
|
|
148
|
+
- section: {id: Catatan}
|
|
149
|
+
fields: [notes]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# Never stored: a flow that must refuse a batch cancel creates one with a reason, and the matching rule fails with
|
|
3
|
+
# its message, rolling the cancel back (like project_guard).
|
|
4
|
+
name: production_guard
|
|
5
|
+
label: {id: Penjaga produksi, en: Production guard}
|
|
6
|
+
icon: check
|
|
7
|
+
naming: PGR-{######}
|
|
8
|
+
title_field: reason
|
|
9
|
+
permissions:
|
|
10
|
+
- {role: head_office, create: true}
|
|
11
|
+
fields:
|
|
12
|
+
- name: reason
|
|
13
|
+
type: select
|
|
14
|
+
label: {id: Alasan}
|
|
15
|
+
required: true
|
|
16
|
+
options:
|
|
17
|
+
- {value: output_used, label: {id: Hasil batch sudah terpakai}}
|
|
18
|
+
- {name: document, type: data, label: {id: Dokumen}}
|
|
19
|
+
rules:
|
|
20
|
+
- name: output_used
|
|
21
|
+
on: save
|
|
22
|
+
check: reason != 'output_used'
|
|
23
|
+
message: {id: 'Hasil batch ini sudah terpakai atau terjual (stoknya di bawah qty hasil); batalkan dokumen pemakainya dulu'}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: production_labour
|
|
3
|
+
is_child: true
|
|
4
|
+
fields:
|
|
5
|
+
- {name: worker, type: link, to: worker, label: {id: Pekerja}, required: true}
|
|
6
|
+
- {name: stage, type: link, to: production_stage, label: {id: Tahap}, required: true}
|
|
7
|
+
- {name: qty, type: float, label: {id: Qty dikerjakan}}
|
|
8
|
+
# always the stage's rate: the piece rate is head office's (production_stage), not typed on the batch
|
|
9
|
+
- {name: rate, type: currency, label: {id: Tarif}, compute: stage.rate}
|
|
10
|
+
- {name: amount, type: currency, label: {id: Upah}, compute: round(qty * rate)}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: production_material
|
|
3
|
+
is_child: true
|
|
4
|
+
fields:
|
|
5
|
+
- {name: item, type: link, to: item, label: {id: Bahan}, required: true}
|
|
6
|
+
- {name: qty, type: float, label: {id: Qty terpakai}}
|
|
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}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: production_output
|
|
3
|
+
is_child: true
|
|
4
|
+
fields:
|
|
5
|
+
- {name: item, type: link, to: item, label: {id: Hasil}, required: true}
|
|
6
|
+
- {name: qty, type: float, label: {id: Qty}}
|
|
7
|
+
- {name: uom, type: link, to: uom, label: {id: Satuan}, default: item.stock_uom}
|
|
8
|
+
- {name: cost_share, type: float, label: {id: Porsi biaya bahan (%)}, default: '100'}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# A production stage paid by the piece (borongan): giling, cetak, kemas. The rate is per unit of work; a stage per
|
|
3
|
+
# product when products pay differently ("Cetak dimsum", "Cetak nugget").
|
|
4
|
+
name: production_stage
|
|
5
|
+
label: {id: Tahap borongan, en: Piece-rate stage}
|
|
6
|
+
icon: stock
|
|
7
|
+
naming: TAHAP-{###}
|
|
8
|
+
title_field: stage_name
|
|
9
|
+
permissions:
|
|
10
|
+
- {role: head_office, read: true, create: true, write: true, delete: true, export: true}
|
|
11
|
+
- {role: outlet_staff, read: true}
|
|
12
|
+
fields:
|
|
13
|
+
- {name: stage_name, type: data, label: {id: Tahap}, required: true, in_list: true}
|
|
14
|
+
- {name: unit, type: data, label: {id: Satuan kerja}, default: "'pak'", in_list: true}
|
|
15
|
+
- {name: rate, type: currency, label: {id: Tarif per satuan}, required: true, in_list: true}
|
|
16
|
+
- {name: active, type: check, label: {id: Aktif}, default: 'true'}
|
|
17
|
+
views:
|
|
18
|
+
list:
|
|
19
|
+
columns: [name, stage_name, unit, rate, active]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: wage_line
|
|
3
|
+
is_child: true
|
|
4
|
+
fields:
|
|
5
|
+
- {name: worker, type: link, to: worker, label: {id: Pekerja}, read_only: true}
|
|
6
|
+
- {name: stage, type: link, to: production_stage, label: {id: Tahap}, read_only: true}
|
|
7
|
+
- {name: qty, type: float, label: {id: Qty}, read_only: true}
|
|
8
|
+
- {name: rate, type: currency, label: {id: Tarif}, read_only: true}
|
|
9
|
+
- {name: amount, type: currency, label: {id: Upah}, read_only: true}
|
|
10
|
+
- {name: work_date, type: date, label: {id: Tanggal kerja}, read_only: true}
|
|
11
|
+
- {name: cancelled, type: check, label: {id: Batal}, read_only: true}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# Piece-rate wages earned in one submitted batch, one line per worker and stage, dated the production day. Made by
|
|
3
|
+
# the flow wage_sheet_on_batch_submitted; a cancelled batch marks its lines cancelled. The weekly recap per worker
|
|
4
|
+
# (dashboard produksi_upah) reads the lines. Every field is read_only: wages are changed on the batch, not here.
|
|
5
|
+
name: wage_sheet
|
|
6
|
+
label: {id: Lembar upah borongan, en: Piece-rate wage sheet}
|
|
7
|
+
icon: card
|
|
8
|
+
naming: UPAH-{YYYY}-{#####}
|
|
9
|
+
title_field: production_batch
|
|
10
|
+
permissions:
|
|
11
|
+
- {role: head_office, read: true, create: true, write: true, export: true, print: true}
|
|
12
|
+
# staff submitting a batch makes its sheet (the flow), but only head office reads wages
|
|
13
|
+
- {role: outlet_staff, create: true}
|
|
14
|
+
fields:
|
|
15
|
+
- {name: production_batch, type: data, label: {id: Batch}, read_only: true, in_list: true}
|
|
16
|
+
- {name: work_date, type: date, label: {id: Tanggal kerja}, read_only: true, in_list: true}
|
|
17
|
+
- {name: cancelled, type: check, label: {id: Batal}, read_only: true, in_list: true}
|
|
18
|
+
- {name: lines, type: table, of: wage_line, label: {id: Upah}, read_only: true}
|
|
19
|
+
- {name: total, type: currency, label: {id: Total upah}, compute: "cancelled ? 0 : lines.map(l, l.amount).sum()", in_list: true}
|
|
20
|
+
rules:
|
|
21
|
+
- name: made_by_batch
|
|
22
|
+
on: save
|
|
23
|
+
check: production_batch != ''
|
|
24
|
+
message: {id: Lembar upah dibuat dari batch yang diajukan}
|
|
25
|
+
views:
|
|
26
|
+
list:
|
|
27
|
+
columns: [name, production_batch, work_date, total, cancelled]
|
|
28
|
+
sort: -work_date
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# Surat perintah kerja (SPK): make qty of a product with a BOM, for stock or for a customer order. The material need
|
|
3
|
+
# is filled from the BOM scaled to qty (flow work_order_materials) and can be edited before release (submit). A
|
|
4
|
+
# semi-finished line is made with its own SPK first. Batches (production_batch) report what was made against it.
|
|
5
|
+
name: work_order
|
|
6
|
+
label: {id: SPK produksi, en: Work order}
|
|
7
|
+
icon: stock
|
|
8
|
+
is_submittable: true
|
|
9
|
+
naming: SPK-{YYYY}-{#####}
|
|
10
|
+
title_field: item
|
|
11
|
+
permissions:
|
|
12
|
+
- {role: head_office, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
13
|
+
- {role: outlet_staff, read: true, print: true}
|
|
14
|
+
fields:
|
|
15
|
+
- {name: item, type: link, to: item, label: {id: Produk}, required: true, in_list: true}
|
|
16
|
+
- {name: bom, type: link, to: bom, label: {id: Resep (BOM)}, default: item.default_bom, required: true}
|
|
17
|
+
- {name: qty, type: float, label: {id: Qty rencana}, required: true, in_list: true}
|
|
18
|
+
- {name: uom, type: link, to: uom, label: {id: Satuan}, default: item.stock_uom}
|
|
19
|
+
- {name: outlet, type: link, to: outlet, label: {id: Tempat produksi}, required: true, in_list: true}
|
|
20
|
+
- {name: start_date, type: date, label: {id: Mulai}, default: today(), required: true, in_list: true}
|
|
21
|
+
- {name: due_date, type: date, label: {id: Target selesai}, in_list: true}
|
|
22
|
+
- name: customer_order
|
|
23
|
+
type: link
|
|
24
|
+
to: customer_order
|
|
25
|
+
label: {id: Untuk pesanan}
|
|
26
|
+
depends_on: app_installed('orders')
|
|
27
|
+
- {name: size_notes, type: text, label: {id: Rincian ukuran / spesifikasi}}
|
|
28
|
+
- {name: materials, type: table, of: work_order_material, label: {id: Kebutuhan bahan}}
|
|
29
|
+
# the qty and BOM the material need was last filled for (flow work_order_materials); a change refills it
|
|
30
|
+
- {name: materials_qty, type: float, label: {id: Bahan dihitung untuk qty}, read_only: true}
|
|
31
|
+
- {name: materials_bom, type: data, label: {id: Bahan dihitung dari resep}, read_only: true}
|
|
32
|
+
- {name: notes, type: text, label: {id: Catatan}}
|
|
33
|
+
rules:
|
|
34
|
+
- name: qty_positive
|
|
35
|
+
on: save
|
|
36
|
+
check: qty > 0
|
|
37
|
+
message: {id: Qty rencana harus lebih dari 0}
|
|
38
|
+
- name: bom_of_item
|
|
39
|
+
on: save
|
|
40
|
+
check: bom == '' || bom.item == item
|
|
41
|
+
message: {id: Resep ini untuk produk lain}
|
|
42
|
+
- name: bom_active
|
|
43
|
+
on: submit
|
|
44
|
+
check: bom.active
|
|
45
|
+
message: {id: Resep tidak aktif}
|
|
46
|
+
- name: due_after_start
|
|
47
|
+
on: save
|
|
48
|
+
check: due_date == '' || due_date >= start_date
|
|
49
|
+
message: {id: Target selesai tidak boleh sebelum tanggal mulai}
|
|
50
|
+
views:
|
|
51
|
+
list:
|
|
52
|
+
columns: [name, item, qty, outlet, start_date, due_date, status]
|
|
53
|
+
sort: -start_date
|
|
54
|
+
form:
|
|
55
|
+
layout:
|
|
56
|
+
- section: {id: SPK}
|
|
57
|
+
columns:
|
|
58
|
+
- [item, bom, qty, uom]
|
|
59
|
+
- [outlet, start_date, due_date, customer_order]
|
|
60
|
+
- section: {id: Kebutuhan bahan}
|
|
61
|
+
fields: [materials]
|
|
62
|
+
- section: {id: Spesifikasi}
|
|
63
|
+
fields: [size_notes, notes]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: work_order_material
|
|
3
|
+
is_child: true
|
|
4
|
+
fields:
|
|
5
|
+
- {name: item, type: link, to: item, label: {id: Bahan}, required: true}
|
|
6
|
+
- {name: qty, type: float, label: {id: Qty dibutuhkan}}
|
|
7
|
+
- {name: uom, type: link, to: uom, label: {id: Satuan}, default: item.stock_uom}
|
|
8
|
+
- {name: semi_finished, type: check, label: {id: Setengah jadi (SPK sendiri)}, compute: "item.default_bom != ''"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
|
|
2
|
+
# Small-factory production: multi-level bills of materials with a rolled-up standard cost, work orders (SPK), batch
|
|
3
|
+
# results with expiry, actual cost per batch (materials at the cost the kernel took them out, piece-rate wages and a
|
|
4
|
+
# simple overhead rate) and piece-rate wage sheets per worker. A batch takes materials out and puts the products in
|
|
5
|
+
# at the value of those materials through the declarative stock block of contract 0021 (K-o). Wages and overhead are
|
|
6
|
+
# in the batch's actual cost (HPP) but not in the stock value until K-r.
|
|
7
|
+
name: production
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
title: {id: Produksi, en: Production}
|
|
10
|
+
requires: {rangka: '>=0.5', users: ^1.0, catalogue: ^1.0, outlets: ^1.0, stock: ^1.0, workforce: ^1.0}
|
|
11
|
+
optional: {orders: ^1.0}
|
|
12
|
+
hooks: [stock.reverse_moves]
|
|
@@ -39,6 +39,10 @@ fields:
|
|
|
39
39
|
- {value: waste, label: {id: Terbuang}}
|
|
40
40
|
- {value: adjustment, label: {id: Penyesuaian}}
|
|
41
41
|
- {value: reversal, label: {id: Pembatalan}}
|
|
42
|
+
- {value: delivery, label: {id: Pengiriman (surat jalan)}}
|
|
43
|
+
- {value: return_in, label: {id: Retur penjualan masuk}}
|
|
44
|
+
- {value: production_out, label: {id: Bahan ke produksi}}
|
|
45
|
+
- {value: production_in, label: {id: Hasil produksi}}
|
|
42
46
|
views:
|
|
43
47
|
list:
|
|
44
48
|
columns: [name, posting_date, outlet, item, qty, value, balance_qty, negative, voucher_type, voucher, reason]
|
|
@@ -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
|
+
version: 1.1.0
|
|
4
4
|
title: {id: Stok, en: Stock}
|
|
5
5
|
requires: {rangka: '>=0.5', users: ^1.0, catalogue: ^1.0, outlets: ^1.0}
|
|
6
6
|
# Semantics fixed in docs/kernel-hooks.md (section stock). stock.post_moves is a core hook on the on_submit of
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/role.json
|
|
2
|
+
name: field_sales
|
|
3
|
+
label: {id: Salesman}
|
|
4
|
+
description: {id: Mengambil pesanan dan melihat piutang pelanggan yang dia pegang}
|
|
5
|
+
# Contract 0010 §5: records whose salesman is the member's own user record (customers, orders, invoices, payments,
|
|
6
|
+
# giro, delivery notes). user.name is the member's user record (rangka user add --record).
|
|
7
|
+
scope: {field: salesman, from: '[user.name]'}
|