@rangka-os/create 0.5.0-alpha.5 → 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/fnb_cabang/dashboards/stock_recap.rk +6 -4
- 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/jasa_proyek/app.rk +5 -4
- package/template/base/apps/jasa_proyek/dashboards/jasa_overview.rk +20 -0
- package/template/base/apps/jasa_proyek/dashboards/project_margin.rk +66 -0
- package/template/base/apps/jasa_proyek/processes/quote_to_cash.rk +2 -1
- 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/apps/ritel_cabang/app.rk +50 -0
- package/template/base/apps/ritel_cabang/dashboards/ritel_overview.rk +123 -0
- package/template/base/apps/ritel_cabang/dashboards/ritel_stock.rk +146 -0
- package/template/base/apps/ritel_cabang/dashboards/ritel_tax.rk +76 -0
- package/template/base/connectors/loyverse/connector.rk +93 -0
- package/template/base/connectors/moka/connector.rk +81 -0
- package/template/base/connectors/whatsapp_business/connector.rk +16 -0
- package/template/base/connectors/whatsapp_business/templates.md +32 -0
- package/template/base/connectors/xendit/connector.rk +179 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_claim.rk +19 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_confirm.rk +43 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_link_locked.rk +11 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_matched.rk +13 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_release.rk +11 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_suggest.rk +21 -0
- package/template/base/modules/bank_statement/flows/bank_transaction_unmatched.rk +11 -0
- package/template/base/modules/bank_statement/imports/bank_statement_csv.rk +25 -0
- package/template/base/modules/bank_statement/models/bank_transaction.rk +124 -0
- package/template/base/modules/bank_statement/models/bank_transaction_claim.rk +49 -0
- package/template/base/modules/bank_statement/module.rk +7 -0
- package/template/base/modules/catalogue/imports/item_list.rk +20 -0
- package/template/base/modules/catalogue/imports/item_master.rk +25 -0
- package/template/base/modules/catalogue/models/item.rk +56 -1
- package/template/base/modules/catalogue/models/item_category.rk +27 -0
- package/template/base/modules/catalogue/models/uom.rk +1 -0
- package/template/base/modules/catalogue/module.rk +2 -1
- package/template/base/modules/consignment/flows/consignment_bill.rk +36 -0
- package/template/base/modules/consignment/flows/consignment_bill_cancelled.rk +14 -0
- package/template/base/modules/consignment/models/consignment_settlement.rk +93 -0
- package/template/base/modules/consignment/models/consignment_settlement_item.rk +37 -0
- package/template/base/modules/consignment/module.rk +10 -0
- package/template/base/modules/contacts/imports/customer_list.rk +17 -0
- package/template/base/modules/contacts/imports/vendor_list.rk +16 -0
- 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/flows/invoice_due_digest.rk +12 -0
- package/template/base/modules/invoicing/flows/milestone_invoiced.rk +23 -0
- package/template/base/modules/invoicing/flows/milestone_reopened.rk +19 -0
- package/template/base/modules/invoicing/flows/project_billed_on_cancel.rk +16 -0
- package/template/base/modules/invoicing/flows/project_billed_on_submit.rk +16 -0
- package/template/base/modules/invoicing/flows/project_revenue_on_cancel.rk +22 -0
- package/template/base/modules/invoicing/flows/project_revenue_on_submit.rk +17 -0
- package/template/base/modules/invoicing/models/invoice_reminder.rk +83 -0
- package/template/base/modules/invoicing/models/sales_invoice.rk +108 -3
- package/template/base/modules/invoicing/models/sales_invoice_item.rk +9 -0
- package/template/base/modules/invoicing/module.rk +2 -2
- package/template/base/modules/invoicing/print/sales_invoice.html +2 -1
- package/template/base/modules/invoicing/print/sales_invoice_whatsapp.html +33 -0
- package/template/base/modules/invoicing/print/sales_invoice_whatsapp.rk +8 -0
- 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/outlet_sales/flows/moka_legacy_key_overlap.rk +22 -0
- package/template/base/modules/outlet_sales/imports/daily_form.rk +3 -1
- package/template/base/modules/outlet_sales/imports/loyverse_receipts.rk +28 -0
- package/template/base/modules/outlet_sales/imports/moka_item_details.rk +14 -4
- package/template/base/modules/outlet_sales/imports/pos_sales_file.rk +28 -0
- package/template/base/modules/outlet_sales/imports/takings_file.rk +23 -0
- package/template/base/modules/outlet_sales/models/outlet_sales.rk +72 -6
- package/template/base/modules/outlet_sales/models/outlet_sales_line.rk +1 -0
- package/template/base/modules/outlet_sales/models/outlet_takings.rk +83 -0
- package/template/base/modules/outlet_sales/models/outlet_takings_line.rk +37 -0
- package/template/base/modules/outlets/models/outlet.rk +18 -0
- package/template/base/modules/outlets/module.rk +1 -1
- package/template/base/modules/payments/flows/payment_gateway_claim_created.rk +19 -0
- package/template/base/modules/payments/flows/payment_gateway_claim_submitted.rk +19 -0
- package/template/base/modules/payments/flows/payment_gateway_release.rk +12 -0
- package/template/base/modules/payments/models/gateway_ref_claim.rk +42 -0
- package/template/base/modules/payments/models/payment.rk +59 -1
- package/template/base/modules/payments/models/withholding.rk +3 -1
- package/template/base/modules/payments/module.rk +2 -2
- package/template/base/modules/procurement/flows/project_vendor_cost_on_cancel.rk +22 -0
- package/template/base/modules/procurement/flows/project_vendor_cost_on_submit.rk +17 -0
- package/template/base/modules/procurement/imports/opening_stock.rk +25 -0
- package/template/base/modules/procurement/models/goods_receipt.rk +1 -1
- package/template/base/modules/procurement/models/purchase_order.rk +15 -7
- package/template/base/modules/procurement/models/purchase_request.rk +11 -1
- package/template/base/modules/procurement/models/vendor_bill.rk +12 -1
- package/template/base/modules/procurement/module.rk +1 -1
- 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/projects/flows/milestone_back_on_acceptance_cancel.rk +15 -0
- package/template/base/modules/projects/flows/milestone_lock_on_update.rk +16 -0
- package/template/base/modules/projects/flows/milestone_ready_on_acceptance.rk +40 -0
- package/template/base/modules/projects/flows/milestone_scheduled_on_create.rk +14 -0
- package/template/base/modules/projects/flows/milestone_scheduled_on_update.rk +27 -0
- package/template/base/modules/projects/flows/project_expense_on_cancel.rk +21 -0
- package/template/base/modules/projects/flows/project_expense_on_submit.rk +16 -0
- package/template/base/modules/projects/flows/project_labor_on_cancel.rk +22 -0
- package/template/base/modules/projects/flows/project_labor_on_submit.rk +17 -0
- package/template/base/modules/projects/flows/project_terms_lock.rk +26 -0
- package/template/base/modules/projects/flows/vendor_bill_cancel_guard.rk +15 -0
- package/template/base/modules/projects/imports/billing_milestone.rk +20 -0
- package/template/base/modules/projects/models/assignment.rk +21 -1
- package/template/base/modules/projects/models/billing_milestone.rk +217 -0
- package/template/base/modules/projects/models/project.rk +76 -2
- package/template/base/modules/projects/models/project_expense.rk +119 -0
- package/template/base/modules/projects/models/project_guard.rk +27 -0
- package/template/base/modules/projects/models/project_ledger.rk +132 -0
- package/template/base/modules/projects/models/timesheet.rk +38 -3
- package/template/base/modules/projects/module.rk +1 -1
- package/template/base/modules/stock/flows/adjustment_value_backfill.rk +94 -0
- package/template/base/modules/stock/flows/adjustment_value_on_cancel.rk +19 -0
- package/template/base/modules/stock/flows/adjustment_value_on_submit.rk +17 -0
- package/template/base/modules/stock/models/recipe.rk +8 -0
- package/template/base/modules/stock/models/stock_adjustment.rk +1 -0
- package/template/base/modules/stock/models/stock_adjustment_value.rk +75 -0
- package/template/base/modules/stock/models/stock_balance.rk +3 -0
- package/template/base/modules/stock/models/stock_move.rk +10 -1
- 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
- package/template/base/modules/workforce/imports/worker_list.rk +16 -0
- package/template/base/modules/workforce/models/worker.rk +22 -1
|
@@ -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]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: milestone_back_on_acceptance_cancel
|
|
3
|
+
label: {id: Termin kembali direncanakan saat berita acara dibatalkan}
|
|
4
|
+
# A cancelled acceptance report takes back the "ready" it gave: the milestone is planned again. It keeps the link to
|
|
5
|
+
# the cancelled report, so an amendment of that report can take it over (and only one amendment can). An invoiced
|
|
6
|
+
# milestone keeps its state; if its invoice is cancelled too, it goes back to planned (milestone_reopened).
|
|
7
|
+
on: acceptance.cancelled
|
|
8
|
+
steps:
|
|
9
|
+
- find: billing_milestone
|
|
10
|
+
where: project == event.project && acceptance == event.name && state == 'ready'
|
|
11
|
+
as: ms
|
|
12
|
+
- if: ms != null
|
|
13
|
+
update: ms
|
|
14
|
+
set:
|
|
15
|
+
state: "'planned'"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: milestone_lock_on_update
|
|
3
|
+
label: {id: Termin siap atau tertagih terkunci}
|
|
4
|
+
# Inside a person's edit of a milestone (flows' own updates do not start it): when the milestone is no longer planned
|
|
5
|
+
# (ready or invoiced) and the edit changes its amount, basis, kind or period (which hold its retainer month), or project, the milestone is marked locked_edit and rule
|
|
6
|
+
# edit_locked refuses the whole save. A billed milestone can thus never be shrunk or moved to make room in a schedule.
|
|
7
|
+
on: billing_milestone.updated
|
|
8
|
+
if: >-
|
|
9
|
+
(event.before.state != 'planned' && (event.amount != event.before.amount || event.basis != event.before.basis
|
|
10
|
+
|| event.kind != event.before.kind || event.period_from != event.before.period_from || event.period_to != event.before.period_to))
|
|
11
|
+
|| event.project != event.before.project
|
|
12
|
+
steps:
|
|
13
|
+
- {find: billing_milestone, where: name == event.name, as: ms}
|
|
14
|
+
- update: ms
|
|
15
|
+
set:
|
|
16
|
+
locked_edit: 'true'
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: milestone_ready_on_acceptance
|
|
3
|
+
label: {id: Termin siap ditagih setelah berita acara}
|
|
4
|
+
# Runs inside the acceptance report's submit, as the project admin submitting it. "Ready" comes only from a live
|
|
5
|
+
# report:
|
|
6
|
+
# - an amended report (amended_from set) never moves the schedule forward: it only takes over the milestone still
|
|
7
|
+
# linked to the report it amends (the cancel flow keeps that link). A second amendment of the same report finds
|
|
8
|
+
# nothing, because the first one took the link over.
|
|
9
|
+
# - a new report makes the project's next planned acceptance milestone (lowest seq) ready, links it and notifies
|
|
10
|
+
# finance in-app. The invoice itself is made by finance (project admins may not invoice, docs/permissions.md).
|
|
11
|
+
on: acceptance.submitted
|
|
12
|
+
steps:
|
|
13
|
+
- if: event.amended_from != ''
|
|
14
|
+
find: billing_milestone
|
|
15
|
+
where: project == event.project && acceptance == event.amended_from
|
|
16
|
+
as: prev
|
|
17
|
+
- if: event.amended_from != '' && prev != null
|
|
18
|
+
update: prev
|
|
19
|
+
set:
|
|
20
|
+
acceptance: event.name
|
|
21
|
+
state: "prev.state == 'planned' ? 'ready' : prev.state"
|
|
22
|
+
- if: event.amended_from == ''
|
|
23
|
+
find_all: billing_milestone
|
|
24
|
+
where: project == event.project && trigger == 'acceptance' && state == 'planned'
|
|
25
|
+
sort: seq
|
|
26
|
+
limit: 1
|
|
27
|
+
as: next
|
|
28
|
+
- if: event.amended_from == '' && size(next) > 0
|
|
29
|
+
find: billing_milestone
|
|
30
|
+
where: name == next[0].name
|
|
31
|
+
as: ms
|
|
32
|
+
- if: event.amended_from == '' && size(next) > 0
|
|
33
|
+
update: ms
|
|
34
|
+
set:
|
|
35
|
+
state: "'ready'"
|
|
36
|
+
acceptance: event.name
|
|
37
|
+
- if: event.amended_from == '' && size(next) > 0
|
|
38
|
+
notify: finance_manager
|
|
39
|
+
channel: in_app
|
|
40
|
+
template: {id: 'Termin {ms.title} proyek {event.project} siap ditagih (Rp {ms.amount})'}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: milestone_scheduled_on_create
|
|
3
|
+
label: {id: Termin masuk jadwal proyek}
|
|
4
|
+
# scheduled_amount is recomputed from all the project's milestones (those made before it existed included); the
|
|
5
|
+
# project's rule schedule_within_contract then refuses a schedule above the contract.
|
|
6
|
+
on: billing_milestone.created
|
|
7
|
+
steps:
|
|
8
|
+
- find_all: billing_milestone
|
|
9
|
+
where: project == event.project
|
|
10
|
+
as: all
|
|
11
|
+
- {find: project, where: name == event.project, as: prj}
|
|
12
|
+
- update: prj
|
|
13
|
+
set:
|
|
14
|
+
scheduled_amount: "size(all) == 0 ? 0 : all.map(m, m.amount).sum()"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: milestone_scheduled_on_update
|
|
3
|
+
label: {id: Nilai termin berubah}
|
|
4
|
+
# scheduled_amount is recomputed from all the project's milestones (those made before it existed included); the
|
|
5
|
+
# project's rule schedule_within_contract then refuses a schedule above the contract.
|
|
6
|
+
on: billing_milestone.updated
|
|
7
|
+
if: event.amount != event.before.amount || event.project != event.before.project
|
|
8
|
+
steps:
|
|
9
|
+
- if: event.project != event.before.project
|
|
10
|
+
find_all: billing_milestone
|
|
11
|
+
where: project == event.before.project
|
|
12
|
+
as: rest
|
|
13
|
+
- if: event.project != event.before.project
|
|
14
|
+
find: project
|
|
15
|
+
where: name == event.before.project
|
|
16
|
+
as: old
|
|
17
|
+
- if: event.project != event.before.project
|
|
18
|
+
update: old
|
|
19
|
+
set:
|
|
20
|
+
scheduled_amount: "size(rest) == 0 ? 0 : rest.map(m, m.amount).sum()"
|
|
21
|
+
- find_all: billing_milestone
|
|
22
|
+
where: project == event.project
|
|
23
|
+
as: all
|
|
24
|
+
- {find: project, where: name == event.project, as: prj}
|
|
25
|
+
- update: prj
|
|
26
|
+
set:
|
|
27
|
+
scheduled_amount: "size(all) == 0 ? 0 : all.map(m, m.amount).sum()"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: project_expense_on_cancel
|
|
3
|
+
label: {id: Biaya 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: project_expense.cancelled
|
|
6
|
+
steps:
|
|
7
|
+
- find: project_ledger
|
|
8
|
+
where: source_name == event.name && kind == 'expense' && entry == 'post'
|
|
9
|
+
as: orig
|
|
10
|
+
- if: orig != null
|
|
11
|
+
create: project_ledger
|
|
12
|
+
set:
|
|
13
|
+
project: event.project
|
|
14
|
+
posting_date: orig.posting_date
|
|
15
|
+
entry: "'reverse'"
|
|
16
|
+
reverses: orig.name
|
|
17
|
+
kind: "'expense'"
|
|
18
|
+
source_model: event.model
|
|
19
|
+
source_name: event.name
|
|
20
|
+
project_expense: event.name
|
|
21
|
+
amount: "0 - orig.amount"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: project_expense_on_submit
|
|
3
|
+
label: {id: Biaya proyek tercatat}
|
|
4
|
+
# Project ledger row (projects): the sum of a project's rows is its margin.
|
|
5
|
+
on: project_expense.submitted
|
|
6
|
+
steps:
|
|
7
|
+
- create: project_ledger
|
|
8
|
+
set:
|
|
9
|
+
project: event.project
|
|
10
|
+
posting_date: event.expense_date
|
|
11
|
+
entry: "'post'"
|
|
12
|
+
kind: "'expense'"
|
|
13
|
+
source_model: event.model
|
|
14
|
+
source_name: event.name
|
|
15
|
+
project_expense: event.name
|
|
16
|
+
amount: "0 - event.amount"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: project_labor_on_cancel
|
|
3
|
+
label: {id: Biaya tenaga kerja 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: timesheet.cancelled
|
|
6
|
+
if: event.cost_amount != 0
|
|
7
|
+
steps:
|
|
8
|
+
- find: project_ledger
|
|
9
|
+
where: source_name == event.name && kind == 'labor' && 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: "'labor'"
|
|
19
|
+
source_model: event.model
|
|
20
|
+
source_name: event.name
|
|
21
|
+
timesheet: 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_labor_on_submit
|
|
3
|
+
label: {id: Biaya tenaga kerja proyek}
|
|
4
|
+
# Project ledger row (projects): the sum of a project's rows is its margin.
|
|
5
|
+
on: timesheet.submitted
|
|
6
|
+
if: event.cost_amount != 0
|
|
7
|
+
steps:
|
|
8
|
+
- create: project_ledger
|
|
9
|
+
set:
|
|
10
|
+
project: event.project
|
|
11
|
+
posting_date: event.work_date
|
|
12
|
+
entry: "'post'"
|
|
13
|
+
kind: "'labor'"
|
|
14
|
+
source_model: event.model
|
|
15
|
+
source_name: event.name
|
|
16
|
+
timesheet: event.name
|
|
17
|
+
amount: "0 - event.cost_amount"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: project_terms_lock
|
|
3
|
+
label: {id: Syarat komersial proyek terkunci}
|
|
4
|
+
# Inside a person's edit of a project that changes its contract value or billing model: refused (locked_terms + rule
|
|
5
|
+
# terms_locked) once the project has a submitted invoice or any billing milestone, read from the documents themselves
|
|
6
|
+
# so data from before this flow existed is covered too. Contract 0 stays "no limit" for projects billed without a
|
|
7
|
+
# contract value, but cannot be reached after the fact.
|
|
8
|
+
on: project.updated
|
|
9
|
+
if: event.contract_value != event.before.contract_value || event.billing_model != event.before.billing_model
|
|
10
|
+
steps:
|
|
11
|
+
- find_all: sales_invoice
|
|
12
|
+
where: project == event.name && docstatus == 1
|
|
13
|
+
limit: 1
|
|
14
|
+
as: invs
|
|
15
|
+
- find_all: billing_milestone
|
|
16
|
+
where: project == event.name
|
|
17
|
+
limit: 1
|
|
18
|
+
as: ms
|
|
19
|
+
- if: size(invs) > 0 || size(ms) > 0
|
|
20
|
+
find: project
|
|
21
|
+
where: name == event.name
|
|
22
|
+
as: prj
|
|
23
|
+
- if: size(invs) > 0 || size(ms) > 0
|
|
24
|
+
update: prj
|
|
25
|
+
set:
|
|
26
|
+
locked_terms: 'true'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: vendor_bill_cancel_guard
|
|
3
|
+
label: {id: Tagihan dipakai biaya proyek tidak bisa dibatalkan}
|
|
4
|
+
# Inside a vendor bill's cancel: when a live project expense links this bill, the cancel is refused (project_guard),
|
|
5
|
+
# so the bill cannot be amended with the project and counted again next to the expense.
|
|
6
|
+
on: vendor_bill.cancelled
|
|
7
|
+
steps:
|
|
8
|
+
- find: project_expense
|
|
9
|
+
where: vendor_bill == event.name && docstatus == 1
|
|
10
|
+
as: ex
|
|
11
|
+
- if: ex != null
|
|
12
|
+
create: project_guard
|
|
13
|
+
set:
|
|
14
|
+
reason: "'bill_has_expense'"
|
|
15
|
+
document: ex.name
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
|
|
2
|
+
# A project's billing schedule from a sheet: twelve monthly retainers or the milestones of an SPK in one upload.
|
|
3
|
+
# Proyek is the project number (PRJ-...). One row = one milestone; the same row twice is skipped by the key.
|
|
4
|
+
name: billing_milestone
|
|
5
|
+
label: {id: Jadwal termin tagihan, en: Billing schedule}
|
|
6
|
+
model: billing_milestone
|
|
7
|
+
source: csv
|
|
8
|
+
header_row: 1
|
|
9
|
+
key: [Proyek, Urutan]
|
|
10
|
+
map:
|
|
11
|
+
project: Proyek
|
|
12
|
+
seq: Urutan
|
|
13
|
+
title: Judul
|
|
14
|
+
kind: Jenis
|
|
15
|
+
basis: "='amount'"
|
|
16
|
+
amount_fixed: Nominal
|
|
17
|
+
trigger: "='date'"
|
|
18
|
+
due_date: Jatuh tempo
|
|
19
|
+
period_from: Periode dari
|
|
20
|
+
period_to: Periode sampai
|