@rangka-os/create 0.5.0-alpha.5 → 0.5.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/base/apps/fnb_cabang/dashboards/stock_recap.rk +6 -4
- 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/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 +34 -1
- package/template/base/modules/catalogue/models/item_category.rk +26 -0
- 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/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 +93 -3
- package/template/base/modules/invoicing/models/sales_invoice_item.rk +9 -0
- package/template/base/modules/invoicing/module.rk +1 -1
- 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/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 +17 -0
- 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 +26 -1
- package/template/base/modules/payments/models/withholding.rk +3 -1
- package/template/base/modules/payments/module.rk +1 -1
- 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/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 +6 -1
- package/template/base/modules/workforce/imports/worker_list.rk +16 -0
- package/template/base/modules/workforce/models/worker.rk +22 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: project_ledger
|
|
3
|
+
label: {id: Buku untung proyek, en: Project ledger}
|
|
4
|
+
icon: chart
|
|
5
|
+
naming: PL-{YYYY}-{######}
|
|
6
|
+
title_field: project
|
|
7
|
+
# One signed row per submitted document that changes a project's result: revenue + (invoice dpp, retention releases
|
|
8
|
+
# excluded), costs - (timesheet cost, project expense not on a vendor bill, vendor bill dpp). Cancelling the document
|
|
9
|
+
# writes the opposite row on the document's own date, so the sum per project (and per period) is its margin. Rows are
|
|
10
|
+
# written by flows inside the document's submit or cancel. A flow runs as the person submitting, so those roles hold
|
|
11
|
+
# create, and a rule cannot tell a flow from a person; the rules therefore make every row true to its document:
|
|
12
|
+
# - a post row links its source document, on the same project, submitted, with exactly the document's amount and
|
|
13
|
+
# date; one per document (entry_key = source:post);
|
|
14
|
+
# - a reverse row links the post row it reverses (reverses, unique) for the same document, now cancelled, with the
|
|
15
|
+
# opposite amount; one per post row (entry_key = source:reverse).
|
|
16
|
+
# So each cancelled document has exactly one reversal, and only if it had a post row: a document submitted before
|
|
17
|
+
# this model existed has none, and none can be reversed by hand. The only row a person could add by hand is a true
|
|
18
|
+
# post row for such an old, still submitted document.
|
|
19
|
+
permissions:
|
|
20
|
+
- {role: project_admin, read: true, create: true, export: true}
|
|
21
|
+
- {role: finance_manager, read: true, create: true, export: true}
|
|
22
|
+
- {role: sales_manager, read: true, create: true, export: true}
|
|
23
|
+
- {role: purchasing_manager, read: true, create: true}
|
|
24
|
+
fields:
|
|
25
|
+
- name: project
|
|
26
|
+
type: link
|
|
27
|
+
to: project
|
|
28
|
+
label: {id: Proyek}
|
|
29
|
+
required: true
|
|
30
|
+
in_list: true
|
|
31
|
+
- name: posting_date
|
|
32
|
+
type: date
|
|
33
|
+
label: {id: Tanggal}
|
|
34
|
+
required: true
|
|
35
|
+
in_list: true
|
|
36
|
+
- name: kind
|
|
37
|
+
type: select
|
|
38
|
+
label: {id: Jenis}
|
|
39
|
+
required: true
|
|
40
|
+
in_list: true
|
|
41
|
+
chip: true
|
|
42
|
+
options:
|
|
43
|
+
- {value: revenue, label: {id: Pendapatan}}
|
|
44
|
+
- {value: labor, label: {id: Biaya tenaga kerja}}
|
|
45
|
+
- {value: expense, label: {id: Biaya proyek}}
|
|
46
|
+
- {value: vendor, label: {id: Biaya pemasok}}
|
|
47
|
+
- name: source_model
|
|
48
|
+
type: data
|
|
49
|
+
label: {id: Dokumen}
|
|
50
|
+
required: true
|
|
51
|
+
- name: source_name
|
|
52
|
+
type: data
|
|
53
|
+
label: {id: No. dokumen}
|
|
54
|
+
required: true
|
|
55
|
+
in_list: true
|
|
56
|
+
- name: sales_invoice
|
|
57
|
+
type: link
|
|
58
|
+
to: sales_invoice
|
|
59
|
+
label: {id: Faktur}
|
|
60
|
+
- name: timesheet
|
|
61
|
+
type: link
|
|
62
|
+
to: timesheet
|
|
63
|
+
label: {id: Timesheet}
|
|
64
|
+
- name: project_expense
|
|
65
|
+
type: link
|
|
66
|
+
to: project_expense
|
|
67
|
+
label: {id: Biaya proyek}
|
|
68
|
+
- name: vendor_bill
|
|
69
|
+
type: link
|
|
70
|
+
to: vendor_bill
|
|
71
|
+
label: {id: Tagihan pemasok}
|
|
72
|
+
- name: entry
|
|
73
|
+
type: select
|
|
74
|
+
label: {id: Baris}
|
|
75
|
+
default: "'post'"
|
|
76
|
+
options:
|
|
77
|
+
- {value: post, label: {id: Diajukan}}
|
|
78
|
+
- {value: reverse, label: {id: Pembalik}}
|
|
79
|
+
- name: reverses
|
|
80
|
+
type: link
|
|
81
|
+
to: project_ledger
|
|
82
|
+
label: {id: Membalik baris}
|
|
83
|
+
unique: true
|
|
84
|
+
- name: source_status
|
|
85
|
+
type: int
|
|
86
|
+
label: {id: Status dokumen}
|
|
87
|
+
hidden: true
|
|
88
|
+
compute: "kind == 'revenue' ? sales_invoice.docstatus : (kind == 'labor' ? timesheet.docstatus : (kind == 'expense' ? project_expense.docstatus : vendor_bill.docstatus))"
|
|
89
|
+
- name: source_amount
|
|
90
|
+
type: currency
|
|
91
|
+
label: {id: Nilai dokumen}
|
|
92
|
+
hidden: true
|
|
93
|
+
compute: "kind == 'revenue' ? sales_invoice.dpp : (kind == 'labor' ? 0 - timesheet.cost_amount : (kind == 'expense' ? 0 - project_expense.amount : 0 - vendor_bill.dpp))"
|
|
94
|
+
- name: source_date
|
|
95
|
+
type: date
|
|
96
|
+
label: {id: Tanggal dokumen}
|
|
97
|
+
hidden: true
|
|
98
|
+
compute: "kind == 'revenue' ? sales_invoice.posting_date : (kind == 'labor' ? timesheet.work_date : (kind == 'expense' ? project_expense.expense_date : vendor_bill.bill_date))"
|
|
99
|
+
- name: entry_key
|
|
100
|
+
type: data
|
|
101
|
+
label: {id: Kunci baris}
|
|
102
|
+
hidden: true
|
|
103
|
+
unique: true
|
|
104
|
+
compute: "source_name + ':' + entry"
|
|
105
|
+
- name: amount
|
|
106
|
+
type: currency
|
|
107
|
+
label: {id: 'Nilai (+ pendapatan, - biaya)'}
|
|
108
|
+
in_list: true
|
|
109
|
+
rules:
|
|
110
|
+
- name: source_matches
|
|
111
|
+
on: save
|
|
112
|
+
check: >-
|
|
113
|
+
(kind == 'revenue' && sales_invoice != '' && source_name == sales_invoice && sales_invoice.project == project && sales_invoice.kind != 'retention')
|
|
114
|
+
|| (kind == 'labor' && timesheet != '' && source_name == timesheet && timesheet.project == project)
|
|
115
|
+
|| (kind == 'expense' && project_expense != '' && source_name == project_expense && project_expense.project == project)
|
|
116
|
+
|| (kind == 'vendor' && vendor_bill != '' && source_name == vendor_bill && vendor_bill.project == project)
|
|
117
|
+
message: {id: Baris buku untung proyek harus menunjuk dokumen sumbernya di proyek yang sama}
|
|
118
|
+
- name: post_matches_document
|
|
119
|
+
on: save
|
|
120
|
+
check: entry != 'post' || (reverses == '' && source_status == 1 && amount == source_amount && posting_date == source_date)
|
|
121
|
+
message: {id: Baris diajukan hanya untuk dokumen yang diajukan dengan nilai yang sama}
|
|
122
|
+
- name: reverse_matches_post
|
|
123
|
+
on: save
|
|
124
|
+
check: >-
|
|
125
|
+
entry != 'reverse' || (reverses != '' && source_status == 2 && reverses.entry == 'post' && reverses.source_name == source_name
|
|
126
|
+
&& reverses.kind == kind && reverses.project == project && amount == 0 - reverses.amount && posting_date == reverses.posting_date)
|
|
127
|
+
message: {id: Baris pembalik hanya untuk dokumen yang dibatalkan dan harus menunjuk baris aslinya}
|
|
128
|
+
views:
|
|
129
|
+
list:
|
|
130
|
+
columns: [name, project, posting_date, kind, entry, source_name, amount]
|
|
131
|
+
filters: [project, kind]
|
|
132
|
+
sort: -posting_date
|
|
@@ -54,16 +54,48 @@ fields:
|
|
|
54
54
|
type: currency
|
|
55
55
|
label: {id: Tarif per hari}
|
|
56
56
|
default: assignment.day_rate
|
|
57
|
+
# Per hour when the assignment bills per hour (consultants); per day otherwise, as before.
|
|
58
|
+
- name: rate_basis
|
|
59
|
+
type: select
|
|
60
|
+
label: {id: Satuan tarif}
|
|
61
|
+
default: "assignment != '' ? assignment.rate_basis : 'day'"
|
|
62
|
+
options:
|
|
63
|
+
- {value: day, label: {id: Per hari}}
|
|
64
|
+
- {value: hour, label: {id: Per jam}}
|
|
65
|
+
- name: hour_rate
|
|
66
|
+
type: currency
|
|
67
|
+
label: {id: Tarif per jam}
|
|
68
|
+
default: "assignment != '' ? assignment.hour_rate : worker.hour_rate"
|
|
69
|
+
- name: cost_rate
|
|
70
|
+
type: currency
|
|
71
|
+
label: {id: Biaya per satuan}
|
|
72
|
+
default: "assignment != '' ? assignment.cost_rate : (rate_basis == 'hour' ? worker.cost_hour_rate : worker.cost_day_rate)"
|
|
57
73
|
- name: amount
|
|
58
74
|
type: currency
|
|
59
75
|
label: {id: Jumlah}
|
|
60
|
-
compute: round(days * day_rate)
|
|
76
|
+
compute: "rate_basis == 'hour' ? round(hours * hour_rate) : round(days * day_rate)"
|
|
61
77
|
in_list: true
|
|
78
|
+
- name: cost_amount
|
|
79
|
+
type: currency
|
|
80
|
+
label: {id: Biaya}
|
|
81
|
+
compute: "round((rate_basis == 'hour' ? hours : days) * cost_rate)"
|
|
82
|
+
- name: billable_amount
|
|
83
|
+
type: currency
|
|
84
|
+
label: {id: Jumlah dapat ditagih}
|
|
85
|
+
compute: "billable ? amount : 0"
|
|
62
86
|
rules:
|
|
63
87
|
- name: days_range
|
|
64
88
|
on: save
|
|
65
|
-
check: days > 0 && days <= 1.5
|
|
89
|
+
check: rate_basis == 'hour' || (days > 0 && days <= 1.5)
|
|
66
90
|
message: {id: 'Hari kerja harus lebih dari 0 dan paling banyak 1,5'}
|
|
91
|
+
- name: hour_rate_for_billable_hours
|
|
92
|
+
on: save
|
|
93
|
+
check: rate_basis != 'hour' || !billable || hour_rate > 0
|
|
94
|
+
message: {id: 'Timesheet per jam yang ditagih butuh tarif per jam (isi di tenaga kerja atau penugasan)'}
|
|
95
|
+
- name: hours_range
|
|
96
|
+
on: save
|
|
97
|
+
check: rate_basis != 'hour' || (hours > 0 && hours <= 24)
|
|
98
|
+
message: {id: 'Jam kerja harus lebih dari 0 dan paling banyak 24'}
|
|
67
99
|
views:
|
|
68
100
|
list:
|
|
69
101
|
columns: [name, project, worker, work_date, days, status, amount]
|
|
@@ -79,4 +111,7 @@ views:
|
|
|
79
111
|
- [description, evidence]
|
|
80
112
|
- section: {id: Tagihan}
|
|
81
113
|
columns:
|
|
82
|
-
- [billable, day_rate, amount]
|
|
114
|
+
- [billable, rate_basis, day_rate, hour_rate, amount]
|
|
115
|
+
- section: {id: Biaya internal}
|
|
116
|
+
columns:
|
|
117
|
+
- [cost_rate, cost_amount]
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: adjustment_value_backfill
|
|
3
|
+
label: {id: Lengkapi nilai penyesuaian stok lama}
|
|
4
|
+
# Backfill for adjustments submitted before stock_adjustment_value existed (the kernel has no migrate hook for .rk, and
|
|
5
|
+
# a flow has no loop): every run gives up to five live (docstatus 1) adjustments without a post row the same row the
|
|
6
|
+
# submit flow writes, the sum of their stock moves on the adjustment's date. A live adjustment has no reversal move
|
|
7
|
+
# yet, so the sum is what it moved. One cancelled before this ran needs no row: it nets to zero in its period either
|
|
8
|
+
# way. Safe to run again (it skips adjustments that have a row; entry_key is unique) and by anyone who may read the
|
|
9
|
+
# adjustments, e.g. POST /api/v1/flows/adjustment_value_backfill/run; the schedule finishes the job on its own.
|
|
10
|
+
schedule: "*/5 * * * *"
|
|
11
|
+
steps:
|
|
12
|
+
- find_all: stock_adjustment_value
|
|
13
|
+
where: entry == 'post'
|
|
14
|
+
as: done
|
|
15
|
+
- find: stock_adjustment
|
|
16
|
+
where: "docstatus == 1 && !(name in done.map(d, d.stock_adjustment))"
|
|
17
|
+
as: a1
|
|
18
|
+
- find_all: stock_move
|
|
19
|
+
if: a1 != null
|
|
20
|
+
where: voucher_type == 'stock_adjustment' && voucher == a1.name
|
|
21
|
+
as: m1
|
|
22
|
+
- create: stock_adjustment_value
|
|
23
|
+
if: a1 != null
|
|
24
|
+
set:
|
|
25
|
+
stock_adjustment: a1.name
|
|
26
|
+
entry: "'post'"
|
|
27
|
+
outlet: a1.outlet
|
|
28
|
+
posting_date: a1.adjustment_date
|
|
29
|
+
reason: a1.reason
|
|
30
|
+
value: m1.map(m, m.value).sum()
|
|
31
|
+
- find: stock_adjustment
|
|
32
|
+
where: "docstatus == 1 && !(name in done.map(d, d.stock_adjustment)) && a1 != null && name != a1.name"
|
|
33
|
+
as: a2
|
|
34
|
+
- find_all: stock_move
|
|
35
|
+
if: a2 != null
|
|
36
|
+
where: voucher_type == 'stock_adjustment' && voucher == a2.name
|
|
37
|
+
as: m2
|
|
38
|
+
- create: stock_adjustment_value
|
|
39
|
+
if: a2 != null
|
|
40
|
+
set:
|
|
41
|
+
stock_adjustment: a2.name
|
|
42
|
+
entry: "'post'"
|
|
43
|
+
outlet: a2.outlet
|
|
44
|
+
posting_date: a2.adjustment_date
|
|
45
|
+
reason: a2.reason
|
|
46
|
+
value: m2.map(m, m.value).sum()
|
|
47
|
+
- find: stock_adjustment
|
|
48
|
+
where: "docstatus == 1 && !(name in done.map(d, d.stock_adjustment)) && a2 != null && name != a2.name && name != a1.name"
|
|
49
|
+
as: a3
|
|
50
|
+
- find_all: stock_move
|
|
51
|
+
if: a3 != null
|
|
52
|
+
where: voucher_type == 'stock_adjustment' && voucher == a3.name
|
|
53
|
+
as: m3
|
|
54
|
+
- create: stock_adjustment_value
|
|
55
|
+
if: a3 != null
|
|
56
|
+
set:
|
|
57
|
+
stock_adjustment: a3.name
|
|
58
|
+
entry: "'post'"
|
|
59
|
+
outlet: a3.outlet
|
|
60
|
+
posting_date: a3.adjustment_date
|
|
61
|
+
reason: a3.reason
|
|
62
|
+
value: m3.map(m, m.value).sum()
|
|
63
|
+
- find: stock_adjustment
|
|
64
|
+
where: "docstatus == 1 && !(name in done.map(d, d.stock_adjustment)) && a3 != null && name != a3.name && name != a1.name && name != a2.name"
|
|
65
|
+
as: a4
|
|
66
|
+
- find_all: stock_move
|
|
67
|
+
if: a4 != null
|
|
68
|
+
where: voucher_type == 'stock_adjustment' && voucher == a4.name
|
|
69
|
+
as: m4
|
|
70
|
+
- create: stock_adjustment_value
|
|
71
|
+
if: a4 != null
|
|
72
|
+
set:
|
|
73
|
+
stock_adjustment: a4.name
|
|
74
|
+
entry: "'post'"
|
|
75
|
+
outlet: a4.outlet
|
|
76
|
+
posting_date: a4.adjustment_date
|
|
77
|
+
reason: a4.reason
|
|
78
|
+
value: m4.map(m, m.value).sum()
|
|
79
|
+
- find: stock_adjustment
|
|
80
|
+
where: "docstatus == 1 && !(name in done.map(d, d.stock_adjustment)) && a4 != null && name != a4.name && name != a1.name && name != a2.name && name != a3.name"
|
|
81
|
+
as: a5
|
|
82
|
+
- find_all: stock_move
|
|
83
|
+
if: a5 != null
|
|
84
|
+
where: voucher_type == 'stock_adjustment' && voucher == a5.name
|
|
85
|
+
as: m5
|
|
86
|
+
- create: stock_adjustment_value
|
|
87
|
+
if: a5 != null
|
|
88
|
+
set:
|
|
89
|
+
stock_adjustment: a5.name
|
|
90
|
+
entry: "'post'"
|
|
91
|
+
outlet: a5.outlet
|
|
92
|
+
posting_date: a5.adjustment_date
|
|
93
|
+
reason: a5.reason
|
|
94
|
+
value: m5.map(m, m.value).sum()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: adjustment_value_on_cancel
|
|
3
|
+
label: {id: Nilai penyesuaian stok dibatalkan}
|
|
4
|
+
# Inside the adjustment's cancel: the opposite of its post row, on the adjustment's own date (not the cancel day), so
|
|
5
|
+
# the period it belongs to nets to zero. An adjustment submitted before these rows existed has none and gets none.
|
|
6
|
+
on: stock_adjustment.cancelled
|
|
7
|
+
steps:
|
|
8
|
+
- find: stock_adjustment_value
|
|
9
|
+
where: stock_adjustment == event.name && entry == 'post'
|
|
10
|
+
as: post
|
|
11
|
+
- if: post != null
|
|
12
|
+
create: stock_adjustment_value
|
|
13
|
+
set:
|
|
14
|
+
stock_adjustment: event.name
|
|
15
|
+
entry: "'reverse'"
|
|
16
|
+
outlet: event.outlet
|
|
17
|
+
posting_date: event.adjustment_date
|
|
18
|
+
reason: event.reason
|
|
19
|
+
value: 0 - post.value
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: adjustment_value_on_submit
|
|
3
|
+
label: {id: Nilai penyesuaian stok tercatat}
|
|
4
|
+
# Inside the adjustment's submit, after stock.post_moves: one row with the sum of the moves it wrote, on its date.
|
|
5
|
+
on: stock_adjustment.submitted
|
|
6
|
+
steps:
|
|
7
|
+
- find_all: stock_move
|
|
8
|
+
where: voucher_type == 'stock_adjustment' && voucher == event.name
|
|
9
|
+
as: moves
|
|
10
|
+
- create: stock_adjustment_value
|
|
11
|
+
set:
|
|
12
|
+
stock_adjustment: event.name
|
|
13
|
+
entry: "'post'"
|
|
14
|
+
outlet: event.outlet
|
|
15
|
+
posting_date: event.adjustment_date
|
|
16
|
+
reason: event.reason
|
|
17
|
+
value: moves.map(m, m.value).sum()
|
|
@@ -28,6 +28,14 @@ fields:
|
|
|
28
28
|
label: {id: Aktif}
|
|
29
29
|
default: 'true'
|
|
30
30
|
in_list: true
|
|
31
|
+
# One active recipe per product: the kernel explodes a sale through the last-modified active recipe without a word,
|
|
32
|
+
# and a rule cannot read other records. The unique index skips empty text, so inactive recipes are free.
|
|
33
|
+
- name: active_product
|
|
34
|
+
type: data
|
|
35
|
+
label: {id: Resep aktif untuk produk ini}
|
|
36
|
+
hidden: true
|
|
37
|
+
unique: true
|
|
38
|
+
compute: "active ? product : ''"
|
|
31
39
|
- name: lines
|
|
32
40
|
type: table
|
|
33
41
|
of: recipe_line
|
|
@@ -32,6 +32,7 @@ fields:
|
|
|
32
32
|
- {value: waste, label: {id: Terbuang}}
|
|
33
33
|
- {value: damage, label: {id: Rusak}}
|
|
34
34
|
- {value: expired, label: {id: Kedaluwarsa}}
|
|
35
|
+
- {value: consignment_return, label: {id: Kembali ke penitip}}
|
|
35
36
|
- {value: other, label: {id: Lainnya}}
|
|
36
37
|
- name: items
|
|
37
38
|
type: table
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: stock_adjustment_value
|
|
3
|
+
label: {id: Nilai penyesuaian stok, en: Stock adjustment value}
|
|
4
|
+
icon: stock
|
|
5
|
+
naming: SAV-{YYYY}-{######}
|
|
6
|
+
title_field: stock_adjustment
|
|
7
|
+
# The value a stock adjustment moved, on the adjustment's own date: a post row when it is submitted (the sum of its
|
|
8
|
+
# stock moves), a reverse row with the opposite value when it is cancelled. The kernel dates a reversal move on the
|
|
9
|
+
# cancel day, so a sum over moves leaves a cancelled adjustment in another period; these rows net in the period of
|
|
10
|
+
# the adjustment. Written by flows inside the submit and cancel (a flow runs as the person submitting, so those roles
|
|
11
|
+
# hold create). Every field is read_only, so a client create or write keeps none of its values and fails `required`:
|
|
12
|
+
# only a flow (which the kernel lets set read_only fields) writes a row, and its value is always the sum of the stock
|
|
13
|
+
# moves. Rule source_state and the unique entry_key keep every slot to the flow's own row. Adjustments from before
|
|
14
|
+
# these rows existed get theirs from flow adjustment_value_backfill.
|
|
15
|
+
permissions:
|
|
16
|
+
- {role: head_office, read: true, create: true, export: true}
|
|
17
|
+
- {role: outlet_staff, read: true, create: true}
|
|
18
|
+
fields:
|
|
19
|
+
- name: stock_adjustment
|
|
20
|
+
type: link
|
|
21
|
+
to: stock_adjustment
|
|
22
|
+
label: {id: Penyesuaian stok}
|
|
23
|
+
read_only: true
|
|
24
|
+
required: true
|
|
25
|
+
in_list: true
|
|
26
|
+
- name: entry
|
|
27
|
+
type: select
|
|
28
|
+
label: {id: Baris}
|
|
29
|
+
read_only: true
|
|
30
|
+
required: true
|
|
31
|
+
options:
|
|
32
|
+
- {value: post, label: {id: Diajukan}}
|
|
33
|
+
- {value: reverse, label: {id: Dibatalkan}}
|
|
34
|
+
- name: outlet
|
|
35
|
+
type: link
|
|
36
|
+
to: outlet
|
|
37
|
+
label: {id: Outlet}
|
|
38
|
+
read_only: true
|
|
39
|
+
required: true
|
|
40
|
+
in_list: true
|
|
41
|
+
- name: posting_date
|
|
42
|
+
type: date
|
|
43
|
+
label: {id: Tanggal}
|
|
44
|
+
read_only: true
|
|
45
|
+
required: true
|
|
46
|
+
in_list: true
|
|
47
|
+
- name: reason
|
|
48
|
+
type: data
|
|
49
|
+
label: {id: Alasan}
|
|
50
|
+
read_only: true
|
|
51
|
+
in_list: true
|
|
52
|
+
- name: value
|
|
53
|
+
type: currency
|
|
54
|
+
label: {id: 'Nilai (negatif = keluar)'}
|
|
55
|
+
read_only: true
|
|
56
|
+
in_list: true
|
|
57
|
+
- name: entry_key
|
|
58
|
+
type: data
|
|
59
|
+
label: {id: Kunci baris}
|
|
60
|
+
hidden: true
|
|
61
|
+
unique: true
|
|
62
|
+
compute: "stock_adjustment + ':' + entry"
|
|
63
|
+
rules:
|
|
64
|
+
- name: source_state
|
|
65
|
+
on: save
|
|
66
|
+
check: >-
|
|
67
|
+
stock_adjustment.outlet == outlet && posting_date == stock_adjustment.adjustment_date
|
|
68
|
+
&& reason == stock_adjustment.reason
|
|
69
|
+
&& ((entry == 'post' && stock_adjustment.docstatus == 1) || (entry == 'reverse' && stock_adjustment.docstatus == 2))
|
|
70
|
+
message: {id: Nilai penyesuaian stok hanya dibuat sistem saat penyesuaian diajukan atau dibatalkan}
|
|
71
|
+
views:
|
|
72
|
+
list:
|
|
73
|
+
columns: [name, stock_adjustment, entry, outlet, posting_date, reason, value]
|
|
74
|
+
filters: [outlet, entry]
|
|
75
|
+
sort: -posting_date
|
|
@@ -16,6 +16,9 @@ fields:
|
|
|
16
16
|
- {name: avg_cost, type: currency, label: {id: Rata-rata biaya}, read_only: true, in_list: true}
|
|
17
17
|
- {name: negative, type: check, label: {id: Stok minus}, compute: qty < 0, in_list: true}
|
|
18
18
|
- {name: last_move, type: data, label: {id: Mutasi terakhir}, read_only: true}
|
|
19
|
+
# Written by stock.post_moves on each sale out of this balance (rangka-os#59); older
|
|
20
|
+
# kernels leave it empty, so "not sold for N days" lists stay empty instead of listing every balance.
|
|
21
|
+
- {name: last_sale_date, type: date, label: {id: Terakhir terjual}, read_only: true, in_list: true}
|
|
19
22
|
views:
|
|
20
23
|
list:
|
|
21
24
|
columns: [outlet, item, qty, value, avg_cost, negative]
|
|
@@ -20,6 +20,11 @@ fields:
|
|
|
20
20
|
- {name: negative, type: check, label: {id: Stok minus}, read_only: true, in_list: true}
|
|
21
21
|
- {name: voucher_type, type: data, label: {id: Jenis dokumen}, read_only: true, in_list: true}
|
|
22
22
|
- {name: voucher, type: data, label: {id: Dokumen}, read_only: true, in_list: true}
|
|
23
|
+
# Sold quantity and cost as positive numbers, for best-seller charts (a chart draws positive values). Every move of
|
|
24
|
+
# an outlet_sales document counts: its sales take out (qty < 0) and the reversal of a cancelled one puts back, so a
|
|
25
|
+
# cancelled sale nets to zero.
|
|
26
|
+
- {name: sold_qty, type: float, label: {id: Qty terjual}, compute: "voucher_type == 'outlet_sales' ? -qty : 0"}
|
|
27
|
+
- {name: sold_cost, type: currency, label: {id: Harga pokok terjual}, compute: "voucher_type == 'outlet_sales' ? -value : 0"}
|
|
23
28
|
- name: reason
|
|
24
29
|
type: select
|
|
25
30
|
label: {id: Sebab}
|
|
@@ -31,7 +36,7 @@ fields:
|
|
|
31
36
|
- {value: transfer_out, label: {id: Transfer keluar}}
|
|
32
37
|
- {value: sale, label: {id: Penjualan}}
|
|
33
38
|
- {value: count, label: {id: Opname}}
|
|
34
|
-
- {value: waste, label: {id:
|
|
39
|
+
- {value: waste, label: {id: Terbuang}}
|
|
35
40
|
- {value: adjustment, label: {id: Penyesuaian}}
|
|
36
41
|
- {value: reversal, label: {id: Pembatalan}}
|
|
37
42
|
views:
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
|
|
2
|
+
# The opening list of field workers (manpower, inspectors, trainers): one row per person. Certifications are added on
|
|
3
|
+
# the worker afterwards (a table field, not part of this file). Name plus employee number is the duplicate key, so
|
|
4
|
+
# workers without a number can share a file.
|
|
5
|
+
name: worker_list
|
|
6
|
+
label: {id: Daftar tenaga kerja, en: Worker list}
|
|
7
|
+
model: worker
|
|
8
|
+
source: csv
|
|
9
|
+
header_row: 1
|
|
10
|
+
key: [Nama, Nomor karyawan]
|
|
11
|
+
map:
|
|
12
|
+
worker_name: Nama
|
|
13
|
+
employee_no: Nomor karyawan
|
|
14
|
+
role_title: Jabatan
|
|
15
|
+
phone: WhatsApp
|
|
16
|
+
day_rate: Tarif harian
|
|
@@ -32,6 +32,24 @@ fields:
|
|
|
32
32
|
type: currency
|
|
33
33
|
label: {id: Tarif per hari}
|
|
34
34
|
in_list: true
|
|
35
|
+
# Selling rate per hour, and what an hour or a day of this person costs the firm (pay divided by working days or
|
|
36
|
+
# hours, entered by the owner): project margin reads the cost, the invoice reads the selling rate.
|
|
37
|
+
- name: hour_rate
|
|
38
|
+
type: currency
|
|
39
|
+
label: {id: Tarif per jam}
|
|
40
|
+
default: '0'
|
|
41
|
+
# Pay per person: hidden in forms and lists for roles that do not need it (hidden_for is not enforced by the kernel
|
|
42
|
+
# yet; the REST API still returns it to anyone who may read worker).
|
|
43
|
+
- name: cost_day_rate
|
|
44
|
+
type: currency
|
|
45
|
+
label: {id: Biaya per hari}
|
|
46
|
+
default: '0'
|
|
47
|
+
hidden_for: [sales_manager, purchasing_manager, head_office, outlet_staff, sales_rep]
|
|
48
|
+
- name: cost_hour_rate
|
|
49
|
+
type: currency
|
|
50
|
+
label: {id: Biaya per jam}
|
|
51
|
+
default: '0'
|
|
52
|
+
hidden_for: [sales_manager, purchasing_manager, head_office, outlet_staff, sales_rep]
|
|
35
53
|
- name: active
|
|
36
54
|
type: check
|
|
37
55
|
label: {id: Aktif}
|
|
@@ -48,6 +66,9 @@ views:
|
|
|
48
66
|
- section: {id: Identitas}
|
|
49
67
|
columns:
|
|
50
68
|
- [worker_name, employee_no, role_title]
|
|
51
|
-
- [phone, day_rate, active]
|
|
69
|
+
- [phone, day_rate, hour_rate, active]
|
|
70
|
+
- section: {id: Biaya internal}
|
|
71
|
+
columns:
|
|
72
|
+
- [cost_day_rate, cost_hour_rate]
|
|
52
73
|
- section: {id: Sertifikasi}
|
|
53
74
|
fields: [certifications]
|