@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,12 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# A payment with a gateway id is cancelled: its claim gives the id back, so the payment can be amended or the
|
|
3
|
+
# gateway callback recorded again as a new payment.
|
|
4
|
+
name: payment_gateway_release
|
|
5
|
+
label: {id: Lepas ID gateway saat pembayaran dibatalkan}
|
|
6
|
+
on: payment.cancelled
|
|
7
|
+
if: event.gateway_ref != ''
|
|
8
|
+
steps:
|
|
9
|
+
- {find: gateway_ref_claim, where: gateway_ref == event.gateway_ref && payment == event.name, as: held}
|
|
10
|
+
- update: held
|
|
11
|
+
if: held != null
|
|
12
|
+
set: {gateway_ref: "''", released_ref: event.gateway_ref}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# Which live payment holds a payment gateway's transaction id (Xendit VA, QRIS, payment link). The kernel's
|
|
3
|
+
# `unique` keeps a value on cancelled documents too, so payment.gateway_ref is not unique itself: a cancelled
|
|
4
|
+
# payment must give its id back so that it can be amended or the callback recorded again. The unique index is here,
|
|
5
|
+
# and the flows payment_gateway_claim* and payment_gateway_release keep it in step with the payments:
|
|
6
|
+
# created or submitted -> claim the id (refused when another live payment holds it; a deleted draft holds nothing)
|
|
7
|
+
# cancelled -> release it (gateway_ref emptied, the old id kept in released_ref)
|
|
8
|
+
# People only read it; the flows write it as the person who saves the payment.
|
|
9
|
+
# A payment created inside another flow (a connector callback flow) does not run these flows, because the kernel does
|
|
10
|
+
# not nest flows: such a flow creates the claim itself in the same run (rangka-connectors README, Xendit example).
|
|
11
|
+
name: gateway_ref_claim
|
|
12
|
+
label: {id: Klaim ID gateway, en: Gateway reference claim}
|
|
13
|
+
icon: card
|
|
14
|
+
naming: GWC-{YYYY}-{#####}
|
|
15
|
+
title_field: gateway_ref
|
|
16
|
+
permissions:
|
|
17
|
+
- {role: finance_manager, read: true, create: true, write: true, export: true}
|
|
18
|
+
- {role: sales_manager, read: true, create: true, write: true, export: true}
|
|
19
|
+
- {role: head_office, read: true, create: true, write: true}
|
|
20
|
+
fields:
|
|
21
|
+
- name: gateway_ref
|
|
22
|
+
type: data
|
|
23
|
+
label: {id: ID transaksi gateway}
|
|
24
|
+
unique: true
|
|
25
|
+
read_only: true
|
|
26
|
+
in_list: true
|
|
27
|
+
# data, not link: a draft payment is renamed on submit and may be deleted, and a link to a missing record
|
|
28
|
+
# would make the claim unsavable.
|
|
29
|
+
- name: payment
|
|
30
|
+
type: data
|
|
31
|
+
label: {id: Pembayaran}
|
|
32
|
+
read_only: true
|
|
33
|
+
in_list: true
|
|
34
|
+
- name: released_ref
|
|
35
|
+
type: data
|
|
36
|
+
label: {id: ID yang dilepas}
|
|
37
|
+
help: {id: 'ID gateway dari pembayaran yang dibatalkan; boleh dipakai lagi.'}
|
|
38
|
+
read_only: true
|
|
39
|
+
in_list: true
|
|
40
|
+
views:
|
|
41
|
+
list:
|
|
42
|
+
columns: [gateway_ref, payment, released_ref]
|
|
@@ -12,6 +12,8 @@ permissions:
|
|
|
12
12
|
- {role: sales_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
13
13
|
# head office records vendor payments only
|
|
14
14
|
- {role: head_office, read: true, create: true, write: true, submit: true, print: true, if: direction == 'pay'}
|
|
15
|
+
# a salesman reads the payments of his own customers (role scope salesman)
|
|
16
|
+
- {role: field_sales, read: true, print: true}
|
|
15
17
|
fields:
|
|
16
18
|
- name: direction
|
|
17
19
|
type: select
|
|
@@ -48,10 +50,54 @@ fields:
|
|
|
48
50
|
- {value: transfer, label: {id: Transfer}}
|
|
49
51
|
- {value: cash, label: {id: Tunai}}
|
|
50
52
|
- {value: giro, label: {id: Giro}}
|
|
53
|
+
- {value: sales_return, label: {id: Potong retur}}
|
|
54
|
+
- {value: qris, label: {id: QRIS}}
|
|
55
|
+
- {value: va, label: {id: Virtual account}}
|
|
56
|
+
- {value: ewallet, label: {id: E-wallet}}
|
|
51
57
|
- {value: other, label: {id: Lainnya}}
|
|
52
58
|
- name: reference
|
|
53
59
|
type: data
|
|
54
60
|
label: {id: No. bukti/transfer}
|
|
61
|
+
# A giro (bilyet giro) is a payment when received; module distribution keeps it in the giro register until it clears,
|
|
62
|
+
# and cancelling the payment when the bank returns it opens the invoices again.
|
|
63
|
+
- name: giro_bank
|
|
64
|
+
type: data
|
|
65
|
+
label: {id: Bank penerbit giro}
|
|
66
|
+
depends_on: "app_installed('distribution') && method == 'giro'"
|
|
67
|
+
- name: giro_due_date
|
|
68
|
+
type: date
|
|
69
|
+
label: {id: Tanggal efektif giro}
|
|
70
|
+
depends_on: "app_installed('distribution') && method == 'giro'"
|
|
71
|
+
# A sales return (module delivery) credited to the customer's invoice: no money moves, the invoice is reduced.
|
|
72
|
+
- name: sales_return
|
|
73
|
+
type: link
|
|
74
|
+
to: sales_return
|
|
75
|
+
label: {id: Retur penjualan}
|
|
76
|
+
depends_on: "app_installed('delivery') && method == 'sales_return'"
|
|
77
|
+
- name: salesman
|
|
78
|
+
type: link
|
|
79
|
+
to: user
|
|
80
|
+
label: {id: Salesman}
|
|
81
|
+
default: customer.salesman
|
|
82
|
+
depends_on: "app_installed('distribution') && direction == 'receive'"
|
|
83
|
+
# Payments that arrive through a payment gateway (Xendit VA, QRIS, payment link) carry the gateway's id, so a
|
|
84
|
+
# callback delivered twice finds the payment it already made instead of paying the invoice again. One live
|
|
85
|
+
# payment per id is kept by gateway_ref_claim, not by `unique` here: the kernel's unique index also holds the id
|
|
86
|
+
# on a cancelled payment, which made amending it fail (500) and the callback impossible to record again.
|
|
87
|
+
- name: gateway
|
|
88
|
+
type: select
|
|
89
|
+
label: {id: Gateway pembayaran}
|
|
90
|
+
options:
|
|
91
|
+
- {value: xendit, label: {id: Xendit}}
|
|
92
|
+
- name: gateway_ref
|
|
93
|
+
type: data
|
|
94
|
+
label: {id: ID transaksi gateway}
|
|
95
|
+
# The bank statement line this payment pays (bank_statement module). Not read_only, so amend keeps it; one live
|
|
96
|
+
# payment per line is enforced by bank_transaction_claim when the module is installed.
|
|
97
|
+
- name: bank_transaction
|
|
98
|
+
type: data
|
|
99
|
+
label: {id: Mutasi bank}
|
|
100
|
+
depends_on: direction == 'receive'
|
|
55
101
|
- name: amount
|
|
56
102
|
type: currency
|
|
57
103
|
label: {id: Jumlah uang}
|
|
@@ -84,6 +130,18 @@ fields:
|
|
|
84
130
|
- {name: exchange_rate, type: float, label: {id: Kurs}, default: '1'} # IDR per 1 unit of the foreign currency
|
|
85
131
|
- {name: amount_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Jumlah uang (valas)}, default: '0'}
|
|
86
132
|
rules:
|
|
133
|
+
- name: giro_has_number_and_date
|
|
134
|
+
on: save
|
|
135
|
+
check: "!app_installed('distribution') || method != 'giro' || direction != 'receive' || (reference != '' && giro_bank != '' && giro_due_date != '')"
|
|
136
|
+
message: {id: 'Giro wajib diisi nomor giro (No. bukti), bank penerbit dan tanggal efektif'}
|
|
137
|
+
- name: return_credit_matches
|
|
138
|
+
on: save
|
|
139
|
+
check: "method != 'sales_return' || (app_installed('delivery') && direction == 'receive' && sales_return != '' && sales_return.docstatus == 1 && sales_return.customer == customer && amount <= sales_return.return_total)"
|
|
140
|
+
message: {id: 'Potong retur: pilih retur yang sudah diajukan dari pelanggan yang sama, nilainya paling banyak nilai retur'}
|
|
141
|
+
- name: gateway_has_ref
|
|
142
|
+
on: save
|
|
143
|
+
check: gateway == '' || gateway_ref != ''
|
|
144
|
+
message: {id: Pembayaran lewat gateway wajib punya ID transaksi gateway}
|
|
87
145
|
- name: foreign_needs_rate
|
|
88
146
|
on: save
|
|
89
147
|
check: currency == '' || currency == 'IDR' || exchange_rate > 1
|
|
@@ -141,7 +199,7 @@ views:
|
|
|
141
199
|
- section: {id: Pembayaran}
|
|
142
200
|
columns:
|
|
143
201
|
- [direction, customer, vendor, payment_date]
|
|
144
|
-
- [method, reference, amount]
|
|
202
|
+
- [method, reference, giro_bank, giro_due_date, sales_return, amount, gateway, gateway_ref, bank_transaction, salesman]
|
|
145
203
|
- section: {id: Alokasi}
|
|
146
204
|
fields: [allocations]
|
|
147
205
|
- section: {id: Ringkasan}
|
|
@@ -38,7 +38,9 @@ fields:
|
|
|
38
38
|
- name: dpp
|
|
39
39
|
type: currency
|
|
40
40
|
label: {id: DPP}
|
|
41
|
-
|
|
41
|
+
# The invoice's PPh 23 base (its dpp without the lines kept out of PPh 23). An invoice submitted before that field
|
|
42
|
+
# existed has PPh 23 but an empty base: its dpp was the base then.
|
|
43
|
+
default: "sales_invoice.pph23_amount > 0 && sales_invoice.pph23_dpp == 0 ? sales_invoice.dpp : sales_invoice.pph23_dpp"
|
|
42
44
|
- name: rate
|
|
43
45
|
type: percent
|
|
44
46
|
label: {id: Tarif}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
|
|
2
2
|
name: payments
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.2.0
|
|
4
4
|
title: {id: Pembayaran, en: Payments}
|
|
5
5
|
requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, invoicing: ^1.0, procurement: ^1.0}
|
|
6
|
-
optional: {currency: ^1.0}
|
|
6
|
+
optional: {currency: ^1.0, delivery: ^1.0}
|
|
7
7
|
# Semantics fixed in docs/kernel-hooks.md (section payments).
|
|
8
8
|
hooks: [payments.allocate, payments.unallocate]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: project_vendor_cost_on_cancel
|
|
3
|
+
label: {id: Biaya pemasok 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: vendor_bill.cancelled
|
|
6
|
+
if: event.project != ''
|
|
7
|
+
steps:
|
|
8
|
+
- find: project_ledger
|
|
9
|
+
where: source_name == event.name && kind == 'vendor' && 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: "'vendor'"
|
|
19
|
+
source_model: event.model
|
|
20
|
+
source_name: event.name
|
|
21
|
+
vendor_bill: 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_vendor_cost_on_submit
|
|
3
|
+
label: {id: Biaya pemasok proyek}
|
|
4
|
+
# Project ledger row (projects): the sum of a project's rows is its margin.
|
|
5
|
+
on: vendor_bill.submitted
|
|
6
|
+
if: event.project != ''
|
|
7
|
+
steps:
|
|
8
|
+
- create: project_ledger
|
|
9
|
+
set:
|
|
10
|
+
project: event.project
|
|
11
|
+
posting_date: event.bill_date
|
|
12
|
+
entry: "'post'"
|
|
13
|
+
kind: "'vendor'"
|
|
14
|
+
source_model: event.model
|
|
15
|
+
source_name: event.name
|
|
16
|
+
vendor_bill: event.name
|
|
17
|
+
amount: "0 - event.dpp"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
|
|
2
|
+
# Opening stock of one outlet with its value: one goods receipt per file (rows grouped by Tanggal) from the vendor
|
|
3
|
+
# named "Saldo awal", so the moving average starts at the shop's own cost price. A goods receipt is the only document
|
|
4
|
+
# that brings valued stock in (stock_adjustment only takes out, stock_count has no cost column); without a purchase
|
|
5
|
+
# order it moves stock and writes no payable (payables come only from vendor_bill).
|
|
6
|
+
# Headers: Tanggal, SKU, Qty, Harga pokok (per stock unit). Each SKU once per outlet (key), so a second upload of the
|
|
7
|
+
# same list is skipped. The receipt arrives as a draft: check it, then submit it to post the stock.
|
|
8
|
+
name: opening_stock
|
|
9
|
+
label: {id: Stok awal, en: Opening stock}
|
|
10
|
+
model: goods_receipt
|
|
11
|
+
source: csv
|
|
12
|
+
header_row: 1
|
|
13
|
+
per: outlet
|
|
14
|
+
key: [SKU]
|
|
15
|
+
group: [Tanggal]
|
|
16
|
+
map:
|
|
17
|
+
received_on: Tanggal
|
|
18
|
+
vendor: {value: "='Saldo awal'", match: vendor_name}
|
|
19
|
+
notes: "='Stok awal per ' + row['Tanggal']"
|
|
20
|
+
lines:
|
|
21
|
+
field: items
|
|
22
|
+
map:
|
|
23
|
+
item: {value: SKU, match: sku}
|
|
24
|
+
qty: Qty
|
|
25
|
+
rate: Harga pokok
|
|
@@ -10,7 +10,7 @@ on_submit: [stock.post_moves]
|
|
|
10
10
|
on_cancel: [stock.reverse_moves]
|
|
11
11
|
permissions:
|
|
12
12
|
- {role: purchasing_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
13
|
-
- {role: head_office, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
13
|
+
- {role: head_office, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, import: true, print: true}
|
|
14
14
|
- {role: outlet_staff, read: true, create: true, write: true, submit: true}
|
|
15
15
|
fields:
|
|
16
16
|
- name: purchase_order
|
|
@@ -21,6 +21,13 @@ fields:
|
|
|
21
21
|
type: link
|
|
22
22
|
to: purchase_request
|
|
23
23
|
label: {id: Permintaan pembelian}
|
|
24
|
+
# The project this purchase is for (projects module, optional): subcontract and material costs land in its margin.
|
|
25
|
+
- name: project
|
|
26
|
+
type: link
|
|
27
|
+
to: project
|
|
28
|
+
label: {id: Proyek}
|
|
29
|
+
default: purchase_request.project
|
|
30
|
+
depends_on: app_installed('projects')
|
|
24
31
|
- name: outlet
|
|
25
32
|
type: link
|
|
26
33
|
to: outlet
|
|
@@ -86,6 +93,10 @@ fields:
|
|
|
86
93
|
- {name: ppn_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: PPN (valas)}, compute: "round(dpp_fx * dpp_num / dpp_den * tax_rate / 100, 2)"}
|
|
87
94
|
- {name: grand_total_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Total (valas)}, compute: "dpp_fx + ppn_fx"}
|
|
88
95
|
rules:
|
|
96
|
+
- name: project_open
|
|
97
|
+
on: save
|
|
98
|
+
check: project == '' || project.state != 'closed'
|
|
99
|
+
message: {id: Proyek yang sudah ditutup tidak bisa dipakai untuk pembelian baru}
|
|
89
100
|
- name: foreign_needs_rate
|
|
90
101
|
on: save
|
|
91
102
|
check: currency == '' || currency == 'IDR' || exchange_rate > 1
|
|
@@ -117,12 +128,9 @@ actions:
|
|
|
117
128
|
primary: true
|
|
118
129
|
hook: procurement.receive
|
|
119
130
|
if: docstatus == 1 && received_pct < 100
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
when: "grand_total > 5000000"
|
|
124
|
-
approvers: [purchasing_manager, head_office]
|
|
125
|
-
label: {id: Persetujuan pembelian, en: Purchasing approval}
|
|
131
|
+
# No approval policy here: the threshold and the approver are the owner's choice per business, so a site adds them in
|
|
132
|
+
# custom/purchase_order.rk (contract 0007 §1). A policy in the module would be a floor no site could raise or drop.
|
|
133
|
+
# See examples/sites/demo-fnb and demo-jasa.
|
|
126
134
|
views:
|
|
127
135
|
list:
|
|
128
136
|
columns: [name, vendor, outlet, order_date, status, grand_total, received_pct]
|
|
@@ -131,7 +139,7 @@ views:
|
|
|
131
139
|
layout:
|
|
132
140
|
- section: {id: Pesanan}
|
|
133
141
|
columns:
|
|
134
|
-
- [vendor, purchase_request, outlet]
|
|
142
|
+
- [vendor, purchase_request, outlet, project]
|
|
135
143
|
- [order_date, delivery_date, received_pct]
|
|
136
144
|
- section: {id: Barang}
|
|
137
145
|
fields: [items]
|
|
@@ -20,6 +20,12 @@ fields:
|
|
|
20
20
|
to: outlet
|
|
21
21
|
label: {id: Outlet}
|
|
22
22
|
in_list: true
|
|
23
|
+
# The project this purchase is for (projects module, optional): subcontract and material costs land in its margin.
|
|
24
|
+
- name: project
|
|
25
|
+
type: link
|
|
26
|
+
to: project
|
|
27
|
+
label: {id: Proyek}
|
|
28
|
+
depends_on: app_installed('projects')
|
|
23
29
|
- name: needed_by
|
|
24
30
|
type: date
|
|
25
31
|
label: {id: Dibutuhkan tanggal}
|
|
@@ -50,6 +56,10 @@ fields:
|
|
|
50
56
|
- {value: ordered, label: {id: Sudah dipesan}}
|
|
51
57
|
- {value: closed, label: {id: Ditutup}}
|
|
52
58
|
rules:
|
|
59
|
+
- name: project_open
|
|
60
|
+
on: save
|
|
61
|
+
check: project == '' || project.state != 'closed'
|
|
62
|
+
message: {id: Proyek yang sudah ditutup tidak bisa dipakai untuk pembelian baru}
|
|
53
63
|
- name: qty_positive
|
|
54
64
|
on: save
|
|
55
65
|
check: "items.map(i, i.qty <= 0 ? 1 : 0).sum() == 0"
|
|
@@ -70,7 +80,7 @@ views:
|
|
|
70
80
|
layout:
|
|
71
81
|
- section: {id: Permintaan}
|
|
72
82
|
columns:
|
|
73
|
-
- [requested_by, outlet]
|
|
83
|
+
- [requested_by, outlet, project]
|
|
74
84
|
- [needed_by, state]
|
|
75
85
|
- section: {id: Barang}
|
|
76
86
|
fields: [items]
|
|
@@ -23,6 +23,13 @@ fields:
|
|
|
23
23
|
type: link
|
|
24
24
|
to: purchase_order
|
|
25
25
|
label: {id: Pesanan pembelian}
|
|
26
|
+
# The project this purchase is for (projects module, optional): subcontract and material costs land in its margin.
|
|
27
|
+
- name: project
|
|
28
|
+
type: link
|
|
29
|
+
to: project
|
|
30
|
+
label: {id: Proyek}
|
|
31
|
+
default: purchase_order.project
|
|
32
|
+
depends_on: app_installed('projects')
|
|
26
33
|
- name: goods_receipt
|
|
27
34
|
type: link
|
|
28
35
|
to: goods_receipt
|
|
@@ -106,6 +113,10 @@ fields:
|
|
|
106
113
|
- {name: grand_total_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Total (valas)}, compute: "dpp_fx + ppn_fx"}
|
|
107
114
|
- {name: amount_due_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Tagihan bersih (valas)}, compute: "currency != '' && currency != 'IDR' ? round(grand_total_fx - pph23_amount / exchange_rate, 2) : 0"} # pph23_amount is entered in rupiah only
|
|
108
115
|
rules:
|
|
116
|
+
- name: project_open
|
|
117
|
+
on: save
|
|
118
|
+
check: project == '' || project.state != 'closed'
|
|
119
|
+
message: {id: Proyek yang sudah ditutup tidak bisa dipakai untuk pembelian baru}
|
|
109
120
|
- name: foreign_needs_rate
|
|
110
121
|
on: save
|
|
111
122
|
check: currency == '' || currency == 'IDR' || exchange_rate > 1
|
|
@@ -150,7 +161,7 @@ views:
|
|
|
150
161
|
layout:
|
|
151
162
|
- section: {id: Pemasok}
|
|
152
163
|
columns:
|
|
153
|
-
- [vendor, bill_no, purchase_order, goods_receipt]
|
|
164
|
+
- [vendor, bill_no, purchase_order, goods_receipt, project]
|
|
154
165
|
- [bill_date, due_date]
|
|
155
166
|
- section: {id: Barang/jasa}
|
|
156
167
|
fields: [items]
|
|
@@ -3,7 +3,7 @@ name: procurement
|
|
|
3
3
|
version: 1.0.0
|
|
4
4
|
title: {id: Pembelian, en: Procurement}
|
|
5
5
|
requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, catalogue: ^1.0}
|
|
6
|
-
optional: {outlets: ^1.0, currency: ^1.0, stock: ^1.0}
|
|
6
|
+
optional: {outlets: ^1.0, currency: ^1.0, stock: ^1.0, projects: ^1.0}
|
|
7
7
|
# Semantics fixed in docs/kernel-hooks.md (section procurement). stock.post_moves is a core hook (goods_receipt.on_submit);
|
|
8
8
|
# stock.reverse_moves (goods_receipt.on_cancel) is declared here too, since stock is optional for procurement (a no-op without it).
|
|
9
9
|
hooks: [procurement.make_po, procurement.receive, procurement.post_payable, procurement.reverse_payable, stock.reverse_moves]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Inside a batch's cancel: refused when the finished-goods outlet no longer holds the batch's outputs (they were used
|
|
3
|
+
# by a later batch or sold), or the reversal would leave that stock below zero while its value sits elsewhere.
|
|
4
|
+
name: batch_cancel_guard
|
|
5
|
+
label: {id: Batch yang hasilnya sudah terpakai tidak bisa dibatalkan}
|
|
6
|
+
on: production_batch.cancelled
|
|
7
|
+
steps:
|
|
8
|
+
# the cancel has already reversed the moves: a balance of any output (product or by-product) below zero means it was used
|
|
9
|
+
- {find_all: stock_balance, where: "outlet == event.output_outlet && item in event.outputs.map(o, o.item) && qty < -0.0005", as: used}
|
|
10
|
+
- if: size(used) > 0
|
|
11
|
+
create: production_guard
|
|
12
|
+
set: {reason: "'output_used'", document: event.name}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# A new batch with no lines yet is drafted from its BOM, scaled to the planned qty: materials, the main product with
|
|
3
|
+
# the BOM's material share and the by-products with theirs. Outlet staff fill a batch by hand (they cannot read a BOM
|
|
4
|
+
# back through an update, see work_order_materials_created).
|
|
5
|
+
name: batch_from_bom
|
|
6
|
+
label: {id: Batch diisi dari resep}
|
|
7
|
+
on: production_batch.created
|
|
8
|
+
if: "event.bom != '' && event.planned_qty > 0 && size(event.materials) == 0 && size(event.outputs) == 0 && !('outlet_staff' in user.roles)"
|
|
9
|
+
steps:
|
|
10
|
+
- {find: bom, where: name == event.bom, as: b}
|
|
11
|
+
- {find: production_batch, where: name == event.name, as: pb}
|
|
12
|
+
- update: b
|
|
13
|
+
if: b != null
|
|
14
|
+
set: {bom_name: b.bom_name}
|
|
15
|
+
- update: pb
|
|
16
|
+
if: b != null && b.output_qty > 0
|
|
17
|
+
set:
|
|
18
|
+
materials: "b.lines.map(l, {'item': l.item, 'qty': round(l.qty * event.planned_qty / b.output_qty * 1000) / 1000, 'uom': l.uom})"
|
|
19
|
+
outputs: "[{'item': event.item, 'qty': event.planned_qty, 'cost_share': 100 - b.byproduct_share}] + b.byproducts.map(x, {'item': x.item, 'qty': round(x.qty * event.planned_qty / b.output_qty * 1000) / 1000, 'cost_share': x.cost_share})"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# A cancelled batch cancels its wage sheet, line by line (the weekly recap reads the lines).
|
|
3
|
+
name: wage_sheet_on_batch_cancelled
|
|
4
|
+
label: {id: Upah borongan batch dibatalkan}
|
|
5
|
+
on: production_batch.cancelled
|
|
6
|
+
steps:
|
|
7
|
+
- {find: wage_sheet, where: production_batch == event.name && !cancelled, as: ws}
|
|
8
|
+
- update: ws
|
|
9
|
+
if: ws != null
|
|
10
|
+
set: {cancelled: true}
|
|
11
|
+
- update: ws
|
|
12
|
+
if: ws != null
|
|
13
|
+
set:
|
|
14
|
+
lines: "ws.lines.map(l, {'name': l.name, 'worker': l.worker, 'stage': l.stage, 'qty': l.qty, 'rate': l.rate, 'amount': l.amount, 'work_date': l.work_date, 'cancelled': true})"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# The wages of a submitted batch become a wage sheet (one line per labour row), dated the production day.
|
|
3
|
+
name: wage_sheet_on_batch_submitted
|
|
4
|
+
label: {id: Upah borongan dari batch}
|
|
5
|
+
on: production_batch.submitted
|
|
6
|
+
if: size(event.labour) > 0
|
|
7
|
+
steps:
|
|
8
|
+
- create: wage_sheet
|
|
9
|
+
set:
|
|
10
|
+
production_batch: event.name
|
|
11
|
+
work_date: event.production_date
|
|
12
|
+
lines: "event.labour.map(l, {'worker': l.worker, 'stage': l.stage, 'qty': l.qty, 'rate': l.rate, 'amount': l.amount, 'work_date': event.production_date, 'cancelled': false})"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Fills the SPK's material need from its BOM, scaled to the planned qty, whenever the qty or the BOM differs from
|
|
3
|
+
# the ones it was filled for; lines edited by hand stay until then. A find returns a record without its table rows,
|
|
4
|
+
# so the BOM is read back through an update that changes nothing (head office may write BOMs).
|
|
5
|
+
name: work_order_materials_created
|
|
6
|
+
label: {id: Kebutuhan bahan SPK dari resep}
|
|
7
|
+
on: work_order.created
|
|
8
|
+
if: "event.docstatus == 0 && event.bom != '' && event.qty > 0 && (event.materials_qty != event.qty || event.materials_bom != event.bom) && !('outlet_staff' in user.roles)"
|
|
9
|
+
steps:
|
|
10
|
+
- {find: bom, where: name == event.bom, as: b}
|
|
11
|
+
- {find: work_order, where: name == event.name, as: wo}
|
|
12
|
+
- update: b
|
|
13
|
+
if: b != null
|
|
14
|
+
set: {bom_name: b.bom_name}
|
|
15
|
+
- update: wo
|
|
16
|
+
if: b != null && b.output_qty > 0
|
|
17
|
+
set:
|
|
18
|
+
materials: "b.lines.map(l, {'item': l.item, 'qty': round(l.qty * event.qty / b.output_qty * 1000) / 1000, 'uom': l.uom})"
|
|
19
|
+
materials_qty: event.qty
|
|
20
|
+
materials_bom: event.bom
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Fills the SPK's material need from its BOM, scaled to the planned qty, whenever the qty or the BOM differs from
|
|
3
|
+
# the ones it was filled for; lines edited by hand stay until then. A find returns a record without its table rows,
|
|
4
|
+
# so the BOM is read back through an update that changes nothing (head office may write BOMs).
|
|
5
|
+
name: work_order_materials_updated
|
|
6
|
+
label: {id: Kebutuhan bahan SPK dari resep}
|
|
7
|
+
on: work_order.updated
|
|
8
|
+
if: "event.docstatus == 0 && event.bom != '' && event.qty > 0 && (event.materials_qty != event.qty || event.materials_bom != event.bom) && !('outlet_staff' in user.roles)"
|
|
9
|
+
steps:
|
|
10
|
+
- {find: bom, where: name == event.bom, as: b}
|
|
11
|
+
- {find: work_order, where: name == event.name, as: wo}
|
|
12
|
+
- update: b
|
|
13
|
+
if: b != null
|
|
14
|
+
set: {bom_name: b.bom_name}
|
|
15
|
+
- update: wo
|
|
16
|
+
if: b != null && b.output_qty > 0
|
|
17
|
+
set:
|
|
18
|
+
materials: "b.lines.map(l, {'item': l.item, 'qty': round(l.qty * event.qty / b.output_qty * 1000) / 1000, 'uom': l.uom})"
|
|
19
|
+
materials_qty: event.qty
|
|
20
|
+
materials_bom: event.bom
|
|
@@ -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)}
|