@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,79 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# Giro register (bilyet giro received). A line is made by the flow giro_from_payment when a payment by giro is
|
|
3
|
+
# submitted; finance follows it to the bank (deposited, cleared). When the bank returns it, finance cancels the
|
|
4
|
+
# payment: the kernel opens the invoices again (payments.unallocate) and the flow giro_bounced marks the line bounced
|
|
5
|
+
# and puts the customer on credit hold. Lines are made by the flow (every field is read_only; a line must match its
|
|
6
|
+
# giro payment), once per payment.
|
|
7
|
+
name: giro
|
|
8
|
+
label: {id: Giro masuk, en: Giro received}
|
|
9
|
+
icon: card
|
|
10
|
+
naming: GIRO-{YYYY}-{#####}
|
|
11
|
+
title_field: giro_no
|
|
12
|
+
permissions:
|
|
13
|
+
- {role: finance_manager, read: true, create: true, write: true, export: true, print: true}
|
|
14
|
+
- {role: sales_manager, read: true, create: true, write: true, export: true, print: true}
|
|
15
|
+
- {role: field_sales, read: true}
|
|
16
|
+
fields:
|
|
17
|
+
- {name: giro_no, type: data, label: {id: No. giro}, required: true, read_only: true, in_list: true}
|
|
18
|
+
- {name: bank, type: data, label: {id: Bank penerbit}, read_only: true, in_list: true}
|
|
19
|
+
- {name: customer, type: link, to: customer, label: {id: Pelanggan}, required: true, read_only: true, in_list: true}
|
|
20
|
+
- {name: salesman, type: link, to: user, label: {id: Salesman}, read_only: true, in_list: true}
|
|
21
|
+
- {name: payment, type: link, to: payment, label: {id: Pembayaran}, required: true, read_only: true, peek: [amount, status]}
|
|
22
|
+
- {name: received_on, type: date, label: {id: Diterima}, read_only: true}
|
|
23
|
+
- {name: effective_date, type: date, label: {id: Tanggal efektif}, required: true, read_only: true, in_list: true}
|
|
24
|
+
- {name: amount, type: currency, label: {id: Nilai giro}, read_only: true, in_list: true}
|
|
25
|
+
- name: status
|
|
26
|
+
type: select
|
|
27
|
+
label: {id: Status}
|
|
28
|
+
default: "'received'"
|
|
29
|
+
required: true
|
|
30
|
+
in_list: true
|
|
31
|
+
chip: true
|
|
32
|
+
options:
|
|
33
|
+
- {value: received, label: {id: Diterima}, tone: neutral}
|
|
34
|
+
- {value: deposited, label: {id: Disetor ke bank}, tone: info}
|
|
35
|
+
- {value: cleared, label: {id: Cair}, tone: ok}
|
|
36
|
+
- {value: bounced, label: {id: Ditolak}, tone: bad}
|
|
37
|
+
- {name: deposited_on, type: date, label: {id: Tanggal setor}, depends_on: "status != 'received'"}
|
|
38
|
+
- {name: cleared_on, type: date, label: {id: Tanggal cair}, depends_on: "status == 'cleared'"}
|
|
39
|
+
- {name: bounced_on, type: date, label: {id: Tanggal ditolak}, read_only: true, depends_on: "status == 'bounced'"}
|
|
40
|
+
- {name: bounce_reason, type: data, label: {id: Alasan tolak}, depends_on: "status == 'bounced'"}
|
|
41
|
+
- {name: notes, type: text, label: {id: Catatan}}
|
|
42
|
+
rules:
|
|
43
|
+
- name: matches_payment
|
|
44
|
+
on: save
|
|
45
|
+
check: "payment.method == 'giro' && payment.customer == customer && payment.reference == giro_no"
|
|
46
|
+
message: {id: Baris giro harus sama dengan pembayaran gironya}
|
|
47
|
+
- name: bounced_only_by_cancel
|
|
48
|
+
on: save
|
|
49
|
+
check: "status != 'bounced' || payment.docstatus == 2"
|
|
50
|
+
message: {id: Giro ditolak dicatat dengan membatalkan pembayarannya (faktur terbuka lagi)}
|
|
51
|
+
- name: live_payment_not_bounced
|
|
52
|
+
on: save
|
|
53
|
+
check: "status == 'bounced' || payment.docstatus != 2"
|
|
54
|
+
message: {id: Pembayaran giro ini sudah dibatalkan; statusnya Ditolak}
|
|
55
|
+
- name: deposit_not_before_effective
|
|
56
|
+
on: save
|
|
57
|
+
check: "deposited_on == '' || deposited_on >= effective_date"
|
|
58
|
+
message: {id: Giro baru bisa disetor pada atau setelah tanggal efektifnya}
|
|
59
|
+
- name: cleared_needs_deposit
|
|
60
|
+
on: save
|
|
61
|
+
check: "status != 'cleared' || (deposited_on != '' && cleared_on != '' && cleared_on >= deposited_on)"
|
|
62
|
+
message: {id: Isi tanggal setor dan tanggal cair (tidak sebelum tanggal setor)}
|
|
63
|
+
views:
|
|
64
|
+
list:
|
|
65
|
+
columns: [name, giro_no, customer, salesman, effective_date, amount, status]
|
|
66
|
+
filters: [status, salesman, customer]
|
|
67
|
+
sort: effective_date
|
|
68
|
+
form:
|
|
69
|
+
layout:
|
|
70
|
+
- section: {id: Giro}
|
|
71
|
+
columns:
|
|
72
|
+
- [giro_no, bank, amount, effective_date]
|
|
73
|
+
- [customer, salesman, payment, received_on]
|
|
74
|
+
- section: {id: Ke bank}
|
|
75
|
+
columns:
|
|
76
|
+
- [status, deposited_on, cleared_on]
|
|
77
|
+
- [bounced_on, bounce_reason]
|
|
78
|
+
- section: {id: Catatan}
|
|
79
|
+
fields: [notes]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
|
|
2
|
+
# Sales controls of a distributor: salesmen and their customers (role field_sales), prices per tier, orders held when a
|
|
3
|
+
# customer is on hold, overdue or over its limit (approvals on customer_order), and the giro register. The fields
|
|
4
|
+
# this module switches on live in their own models (customer, item, customer_order, sales_invoice, payment) behind
|
|
5
|
+
# app_installed('distribution'); the flows here keep them current.
|
|
6
|
+
name: distribution
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
title: {id: Distribusi, en: Distribution}
|
|
9
|
+
requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, catalogue: ^1.0, orders: ^1.0, invoicing: ^1.0, payments: ^1.0, procurement: ^1.0}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Morning list of invoices to chase: submitted, money still owed, due today or earlier. Goes to the owner today
|
|
3
|
+
# (notify writes the audit log and email); the WhatsApp reminder to the customer waits for the connector runtime.
|
|
4
|
+
name: invoice_due_digest
|
|
5
|
+
label: {id: Daftar tagih pagi, en: Morning collection list}
|
|
6
|
+
schedule: 0 8 * * 1-6
|
|
7
|
+
steps:
|
|
8
|
+
- {find_all: sales_invoice, where: "docstatus == 1 && outstanding > 0 && due_date <= today()", sort: due_date, as: due}
|
|
9
|
+
- if: size(due) > 0
|
|
10
|
+
notify: owner
|
|
11
|
+
channel: email
|
|
12
|
+
template: {id: 'Tagih hari ini: {size(due)} faktur jatuh tempo, sisa Rp {due.map(i, i.outstanding).sum()}. Cetak "Pesan tagihan WA" di tiap faktur.'}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: milestone_invoiced
|
|
3
|
+
label: {id: Termin ditandai sudah ditagih}
|
|
4
|
+
# Runs inside the invoice's submit, as the person submitting it: the milestone the invoice bills becomes invoiced and
|
|
5
|
+
# points at the invoice, so the schedule shows what is billed and milestone_not_invoiced refuses a second invoice. A
|
|
6
|
+
# retainer month already invoiced on another milestone of the project (also one from before retainer_key) sets
|
|
7
|
+
# month_billed, and rule month_not_billed refuses the submit.
|
|
8
|
+
on: sales_invoice.submitted
|
|
9
|
+
if: event.billing_milestone != ''
|
|
10
|
+
steps:
|
|
11
|
+
- {find: billing_milestone, where: name == event.billing_milestone, as: ms}
|
|
12
|
+
- if: ms != null && ms.kind == 'retainer'
|
|
13
|
+
find_all: billing_milestone
|
|
14
|
+
where: project == ms.project && kind == 'retainer' && period_from == ms.period_from && state == 'invoiced' && name != ms.name
|
|
15
|
+
limit: 1
|
|
16
|
+
as: same_month
|
|
17
|
+
- if: ms != null
|
|
18
|
+
update: ms
|
|
19
|
+
set:
|
|
20
|
+
state: "'invoiced'"
|
|
21
|
+
sales_invoice: event.name
|
|
22
|
+
over_billed: ms.amount < event.dpp
|
|
23
|
+
month_billed: ms.kind == 'retainer' && size(same_month) > 0
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: milestone_reopened
|
|
3
|
+
label: {id: Termin dibuka lagi saat faktur dibatalkan}
|
|
4
|
+
# A cancelled invoice gives its milestone back: ready to bill again when nothing else holds it (a dated milestone, or
|
|
5
|
+
# an acceptance milestone whose report is still live), planned when its report was cancelled too.
|
|
6
|
+
on: sales_invoice.cancelled
|
|
7
|
+
if: event.billing_milestone != ''
|
|
8
|
+
steps:
|
|
9
|
+
- {find: billing_milestone, where: name == event.billing_milestone && sales_invoice == event.name, as: ms}
|
|
10
|
+
- if: ms != null && ms.acceptance != ''
|
|
11
|
+
find: acceptance
|
|
12
|
+
where: name == ms.acceptance
|
|
13
|
+
as: ba
|
|
14
|
+
- if: ms != null
|
|
15
|
+
update: ms
|
|
16
|
+
set:
|
|
17
|
+
state: "ms.trigger == 'acceptance' && (ms.acceptance == '' || ba == null || ba.docstatus != 1) ? 'planned' : 'ready'"
|
|
18
|
+
sales_invoice: "''"
|
|
19
|
+
bill_token: event.name
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: project_billed_on_cancel
|
|
3
|
+
label: {id: Tagihan proyek dihitung ulang saat batal}
|
|
4
|
+
# Inside the invoice's cancel. billed_amount is recomputed from the project's submitted invoices (retention releases excluded), so invoices
|
|
5
|
+
# from before billed_amount existed count too; the project's rule billing_within_contract then refuses the save that
|
|
6
|
+
# would bill the project above its contract.
|
|
7
|
+
on: sales_invoice.cancelled
|
|
8
|
+
if: event.project != ''
|
|
9
|
+
steps:
|
|
10
|
+
- find_all: sales_invoice
|
|
11
|
+
where: project == event.project && docstatus == 1 && kind != 'retention'
|
|
12
|
+
as: invs
|
|
13
|
+
- {find: project, where: name == event.project, as: prj}
|
|
14
|
+
- update: prj
|
|
15
|
+
set:
|
|
16
|
+
billed_amount: "size(invs) == 0 ? 0 : invs.map(i, i.dpp).sum()"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: project_billed_on_submit
|
|
3
|
+
label: {id: Tagihan proyek dihitung ulang}
|
|
4
|
+
# Inside the invoice's submit. billed_amount is recomputed from the project's submitted invoices (retention releases excluded), so invoices
|
|
5
|
+
# from before billed_amount existed count too; the project's rule billing_within_contract then refuses the save that
|
|
6
|
+
# would bill the project above its contract.
|
|
7
|
+
on: sales_invoice.submitted
|
|
8
|
+
if: event.project != ''
|
|
9
|
+
steps:
|
|
10
|
+
- find_all: sales_invoice
|
|
11
|
+
where: project == event.project && docstatus == 1 && kind != 'retention'
|
|
12
|
+
as: invs
|
|
13
|
+
- {find: project, where: name == event.project, as: prj}
|
|
14
|
+
- update: prj
|
|
15
|
+
set:
|
|
16
|
+
billed_amount: "size(invs) == 0 ? 0 : invs.map(i, i.dpp).sum()"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: project_revenue_on_cancel
|
|
3
|
+
label: {id: Pendapatan proyek batal}
|
|
4
|
+
# Project ledger row (projects): a cancel writes the opposite row on the document's date, only when the document has a + row (documents submitted before the ledger existed have none).
|
|
5
|
+
on: sales_invoice.cancelled
|
|
6
|
+
if: event.project != '' && event.kind != 'retention'
|
|
7
|
+
steps:
|
|
8
|
+
- find: project_ledger
|
|
9
|
+
where: source_name == event.name && kind == 'revenue' && entry == 'post'
|
|
10
|
+
as: orig
|
|
11
|
+
- if: orig != null
|
|
12
|
+
create: project_ledger
|
|
13
|
+
set:
|
|
14
|
+
project: event.project
|
|
15
|
+
posting_date: orig.posting_date
|
|
16
|
+
entry: "'reverse'"
|
|
17
|
+
reverses: orig.name
|
|
18
|
+
kind: "'revenue'"
|
|
19
|
+
source_model: event.model
|
|
20
|
+
source_name: event.name
|
|
21
|
+
sales_invoice: event.name
|
|
22
|
+
amount: "0 - orig.amount"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: project_revenue_on_submit
|
|
3
|
+
label: {id: Pendapatan proyek dari faktur}
|
|
4
|
+
# Project ledger row (projects): the sum of a project's rows is its margin.
|
|
5
|
+
on: sales_invoice.submitted
|
|
6
|
+
if: event.project != '' && event.kind != 'retention'
|
|
7
|
+
steps:
|
|
8
|
+
- create: project_ledger
|
|
9
|
+
set:
|
|
10
|
+
project: event.project
|
|
11
|
+
posting_date: event.posting_date
|
|
12
|
+
entry: "'post'"
|
|
13
|
+
kind: "'revenue'"
|
|
14
|
+
source_model: event.model
|
|
15
|
+
source_name: event.name
|
|
16
|
+
sales_invoice: event.name
|
|
17
|
+
amount: "event.dpp"
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
# One row per reminder sent for an invoice (WhatsApp from the owner's phone today; the WhatsApp connector later).
|
|
3
|
+
# A submitted invoice is immutable, so "who was reminded when" lives here, not on sales_invoice.
|
|
4
|
+
name: invoice_reminder
|
|
5
|
+
label: {id: Pengingat tagihan, en: Invoice reminder}
|
|
6
|
+
icon: bell
|
|
7
|
+
naming: REM-{YYYY}-{#####}
|
|
8
|
+
title_field: sales_invoice
|
|
9
|
+
permissions:
|
|
10
|
+
- {role: finance_manager, read: true, create: true, write: true, delete: true, export: true}
|
|
11
|
+
- {role: sales_manager, read: true, create: true, write: true, delete: true, export: true}
|
|
12
|
+
- {role: sales_rep, read: true, create: true}
|
|
13
|
+
fields:
|
|
14
|
+
- name: sales_invoice
|
|
15
|
+
type: link
|
|
16
|
+
to: sales_invoice
|
|
17
|
+
label: {id: Faktur}
|
|
18
|
+
required: true
|
|
19
|
+
in_list: true
|
|
20
|
+
peek: [customer, due_date, outstanding]
|
|
21
|
+
- name: customer
|
|
22
|
+
type: link
|
|
23
|
+
to: customer
|
|
24
|
+
label: {id: Pelanggan}
|
|
25
|
+
default: sales_invoice.customer
|
|
26
|
+
in_list: true
|
|
27
|
+
- name: reminded_on
|
|
28
|
+
type: date
|
|
29
|
+
label: {id: Tanggal}
|
|
30
|
+
default: today()
|
|
31
|
+
required: true
|
|
32
|
+
in_list: true
|
|
33
|
+
- name: channel
|
|
34
|
+
type: select
|
|
35
|
+
label: {id: Lewat}
|
|
36
|
+
default: "'whatsapp'"
|
|
37
|
+
required: true
|
|
38
|
+
chip: true
|
|
39
|
+
in_list: true
|
|
40
|
+
options:
|
|
41
|
+
- {value: whatsapp, label: {id: WhatsApp}}
|
|
42
|
+
- {value: phone, label: {id: Telepon}}
|
|
43
|
+
- {value: email, label: {id: Email}}
|
|
44
|
+
- {value: visit, label: {id: Kunjungan}}
|
|
45
|
+
# Names match the WhatsApp Business templates of rangka-connectors (lowercase snake_case, as Meta requires).
|
|
46
|
+
- name: template
|
|
47
|
+
type: select
|
|
48
|
+
label: {id: Jenis pesan}
|
|
49
|
+
default: "sales_invoice.due_date < today() ? 'pengingat_jatuh_tempo' : 'tagihan_terbit'"
|
|
50
|
+
in_list: true
|
|
51
|
+
options:
|
|
52
|
+
- {value: tagihan_terbit, label: {id: Tagihan terbit}}
|
|
53
|
+
- {value: pengingat_jatuh_tempo, label: {id: Pengingat jatuh tempo}}
|
|
54
|
+
- {value: terima_kasih_lunas, label: {id: 'Terima kasih, sudah lunas'}}
|
|
55
|
+
- name: outstanding
|
|
56
|
+
type: currency
|
|
57
|
+
label: {id: Sisa tagihan saat itu}
|
|
58
|
+
default: sales_invoice.outstanding
|
|
59
|
+
read_only: true
|
|
60
|
+
in_list: true
|
|
61
|
+
- name: promised_date
|
|
62
|
+
type: date
|
|
63
|
+
label: {id: Janji bayar}
|
|
64
|
+
- name: note
|
|
65
|
+
type: text
|
|
66
|
+
label: {id: Catatan}
|
|
67
|
+
rules:
|
|
68
|
+
- name: invoice_submitted
|
|
69
|
+
on: save
|
|
70
|
+
check: sales_invoice.docstatus == 1
|
|
71
|
+
message: {id: Hanya faktur yang sudah diajukan yang bisa ditagih}
|
|
72
|
+
views:
|
|
73
|
+
list:
|
|
74
|
+
columns: [name, sales_invoice, customer, reminded_on, channel, template, outstanding, promised_date]
|
|
75
|
+
sort: -reminded_on
|
|
76
|
+
form:
|
|
77
|
+
layout:
|
|
78
|
+
- section: {id: Pengingat}
|
|
79
|
+
columns:
|
|
80
|
+
- [sales_invoice, customer, outstanding]
|
|
81
|
+
- [reminded_on, channel, template, promised_date]
|
|
82
|
+
- section: {id: Catatan}
|
|
83
|
+
fields: [note]
|
|
@@ -11,6 +11,9 @@ permissions:
|
|
|
11
11
|
- {role: finance_manager, read: true, create: true, write: true, delete: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
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
|
- {role: sales_rep, read: true}
|
|
14
|
+
- {role: field_sales, read: true, print: true}
|
|
15
|
+
# project admins read invoices: the project flows that freeze contract terms read them as the project admin
|
|
16
|
+
- {role: project_admin, read: true}
|
|
14
17
|
fields:
|
|
15
18
|
- name: kind
|
|
16
19
|
type: select
|
|
@@ -29,18 +32,44 @@ fields:
|
|
|
29
32
|
required: true
|
|
30
33
|
in_list: true
|
|
31
34
|
peek: [outstanding, payment_days, npwp]
|
|
35
|
+
default: billing_milestone.customer
|
|
32
36
|
- name: customer_order
|
|
33
37
|
type: link
|
|
34
38
|
to: customer_order
|
|
35
39
|
label: {id: Pesanan pelanggan}
|
|
40
|
+
# The salesman whose customer this is (module distribution), for AR and collections per salesman.
|
|
41
|
+
- name: salesman
|
|
42
|
+
type: link
|
|
43
|
+
to: user
|
|
44
|
+
label: {id: Salesman}
|
|
45
|
+
default: "customer_order != '' && customer_order.salesman != '' ? customer_order.salesman : customer.salesman"
|
|
46
|
+
in_list: true
|
|
47
|
+
depends_on: app_installed('distribution')
|
|
36
48
|
- name: project
|
|
37
49
|
type: link
|
|
38
50
|
to: project
|
|
39
51
|
label: {id: Proyek}
|
|
52
|
+
default: billing_milestone.project
|
|
53
|
+
# The billing milestone this invoice bills (projects module); flows mark it invoiced on submit, ready on cancel.
|
|
54
|
+
# milestone_claim (unique) = milestone:<its bill_token> from the invoice's first save: one invoice per milestone, draft
|
|
55
|
+
# or submitted, and the database refuses a second one even when both are made at the same moment (an amendment
|
|
56
|
+
# re-pointed at the milestone included). A cancelled invoice keeps its claim (the kernel does not recompute on
|
|
57
|
+
# cancel); the cancel flow sets the milestone's bill_token to that invoice, so the next invoice claims a new key.
|
|
58
|
+
- name: billing_milestone
|
|
59
|
+
type: link
|
|
60
|
+
to: billing_milestone
|
|
61
|
+
label: {id: Termin tagihan}
|
|
62
|
+
- name: milestone_claim
|
|
63
|
+
type: data
|
|
64
|
+
label: {id: Faktur untuk termin ini}
|
|
65
|
+
hidden: true
|
|
66
|
+
unique: true
|
|
67
|
+
compute: "billing_milestone == '' ? '' : billing_milestone + ':' + billing_milestone.bill_token"
|
|
40
68
|
- name: acceptance
|
|
41
69
|
type: link
|
|
42
70
|
to: acceptance
|
|
43
71
|
label: {id: Berita acara}
|
|
72
|
+
default: billing_milestone.acceptance
|
|
44
73
|
- name: po_number
|
|
45
74
|
type: data
|
|
46
75
|
label: {id: No. PO pelanggan}
|
|
@@ -127,10 +156,39 @@ fields:
|
|
|
127
156
|
type: percent
|
|
128
157
|
label: {id: Tarif PPh 23}
|
|
129
158
|
default: '2'
|
|
159
|
+
# The PPh 23 base: (subtotal - header discount) x the share of lines not marked pph23_exclude, minus the base already
|
|
160
|
+
# taken on the down-payment invoice this one deducts (that invoice's line base in proportion to down_payment). Equal
|
|
161
|
+
# to dpp when no line is excluded and the DP invoice had none either. Foreign-currency documents take the share from
|
|
162
|
+
# the lines' rupiah twins (amount_fx_idr). "* 1.0" keeps the products in float, clear of int64 overflow. Foreign
|
|
163
|
+
# amounts (money) are Decimal, capped by the kernel at 16 whole digits (an overflow is stored as 0), so a product of a
|
|
164
|
+
# money field and a rupiah amount is never formed: the share is taken from the twins, and pph23_amount_fx multiplies
|
|
165
|
+
# dpp_fx by a ratio below 1.
|
|
166
|
+
- name: pph23_lines_base
|
|
167
|
+
type: currency
|
|
168
|
+
label: {id: Dasar PPh 23 baris}
|
|
169
|
+
hidden: true
|
|
170
|
+
compute: "currency != '' && currency != 'IDR' ? (items.map(i, i.amount_fx_idr).sum() == 0 ? 0 : round((subtotal - discount_amount) * 1.0 * items.map(i, i.pph23_exclude ? 0 : i.amount_fx_idr).sum() / items.map(i, i.amount_fx_idr).sum())) : (subtotal == 0 ? 0 : round((subtotal - discount_amount) * 1.0 * items.map(i, i.pph23_exclude ? 0 : i.amount).sum() / subtotal))"
|
|
171
|
+
- name: pph23_dp_base
|
|
172
|
+
type: currency
|
|
173
|
+
label: {id: Dasar PPh 23 di faktur uang muka}
|
|
174
|
+
hidden: true
|
|
175
|
+
# Recomputed from the DP invoice's own lines with the formula of pph23_lines_base (never its stored pph23_dpp), so a
|
|
176
|
+
# DP invoiced before pph23_dpp existed, in rupiah or in a foreign currency, is deducted like a new one: its lines
|
|
177
|
+
# have no pph23_exclude, so the whole DP is base, as before the upgrade. A foreign DP takes the share from its twins.
|
|
178
|
+
compute: >-
|
|
179
|
+
dp_invoice == '' || dp_invoice.dpp == 0 ? 0 :
|
|
180
|
+
round((dp_invoice.currency != '' && dp_invoice.currency != 'IDR'
|
|
181
|
+
? (dp_invoice.items.map(i, i.amount_fx_idr).sum() == 0 ? 0 : (dp_invoice.subtotal - dp_invoice.discount_amount) * 1.0 * dp_invoice.items.map(i, i.pph23_exclude ? 0 : i.amount_fx_idr).sum() / dp_invoice.items.map(i, i.amount_fx_idr).sum())
|
|
182
|
+
: (dp_invoice.subtotal == 0 ? 0 : (dp_invoice.subtotal - dp_invoice.discount_amount) * 1.0 * dp_invoice.items.map(i, i.pph23_exclude ? 0 : i.amount).sum() / dp_invoice.subtotal))
|
|
183
|
+
* down_payment / dp_invoice.dpp)
|
|
184
|
+
- name: pph23_dpp
|
|
185
|
+
type: currency
|
|
186
|
+
label: {id: Dasar PPh 23}
|
|
187
|
+
compute: "pph23_lines_base > pph23_dp_base ? pph23_lines_base - pph23_dp_base : 0"
|
|
130
188
|
- name: pph23_amount
|
|
131
189
|
type: currency
|
|
132
190
|
label: {id: PPh 23 dipotong pelanggan}
|
|
133
|
-
compute: "pph23_applies ? round(
|
|
191
|
+
compute: "pph23_applies ? round(pph23_dpp * pph23_rate / 100) : 0"
|
|
134
192
|
- name: amount_due
|
|
135
193
|
type: currency
|
|
136
194
|
label: {id: Tagihan bersih}
|
|
@@ -157,9 +215,15 @@ fields:
|
|
|
157
215
|
- {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)"}
|
|
158
216
|
- {name: grand_total_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Total (valas)}, compute: "dpp_fx + ppn_fx"}
|
|
159
217
|
- {name: retention_amount_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Retensi ditahan (valas)}, compute: "round(dpp_fx * retention_percent / 100, 2)"}
|
|
160
|
-
- {name: pph23_amount_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: PPh 23 dipotong (valas)}, compute: "pph23_applies ? round(dpp_fx * pph23_rate / 100, 2) : 0"}
|
|
218
|
+
- {name: pph23_amount_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: PPh 23 dipotong (valas)}, compute: "pph23_applies && dpp != 0 ? round(dpp_fx * (pph23_dpp * 1.0 / dpp * pph23_rate / 100), 2) : 0"}
|
|
161
219
|
- {name: amount_due_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Tagihan bersih (valas)}, compute: "grand_total_fx - retention_amount_fx - pph23_amount_fx"}
|
|
162
220
|
rules:
|
|
221
|
+
# A distributor bills what was delivered (module delivery): per item, no more than delivered, less returns and
|
|
222
|
+
# earlier invoices of the order (order_fulfilment). The flow invoice_qty_from_deliveries sets the draft that way.
|
|
223
|
+
- name: invoice_within_delivered
|
|
224
|
+
on: submit
|
|
225
|
+
check: "!app_installed('delivery') || customer_order == '' || customer_order.fulfilment == '' || items.map(l, items.map(x, x.item == l.item ? x.qty : 0).sum() <= customer_order.fulfilment.items.map(b, b.item == l.item ? b.delivered_qty - b.invoiced_qty : 0).sum() + 0.0005 ? 0 : 1).sum() == 0"
|
|
226
|
+
message: {id: Jumlah ditagih melebihi barang yang sudah dikirim dan belum ditagih}
|
|
163
227
|
- name: qty_positive
|
|
164
228
|
on: save
|
|
165
229
|
check: "items.map(i, i.qty <= 0 ? 1 : 0).sum() == 0"
|
|
@@ -193,6 +257,47 @@ rules:
|
|
|
193
257
|
on: save
|
|
194
258
|
check: project == '' || project.customer == customer
|
|
195
259
|
message: {id: Proyek harus milik pelanggan yang sama}
|
|
260
|
+
- name: milestone_same_project
|
|
261
|
+
on: save
|
|
262
|
+
check: billing_milestone == '' || billing_milestone.project == project
|
|
263
|
+
message: {id: Termin harus milik proyek yang sama}
|
|
264
|
+
- name: milestone_same_customer
|
|
265
|
+
on: save
|
|
266
|
+
check: billing_milestone == '' || billing_milestone.customer == customer
|
|
267
|
+
message: {id: Termin harus milik pelanggan yang sama}
|
|
268
|
+
- name: milestone_amount_cap
|
|
269
|
+
on: save
|
|
270
|
+
check: billing_milestone == '' || dpp <= billing_milestone.amount
|
|
271
|
+
message: {id: DPP faktur tidak boleh melebihi nilai termin}
|
|
272
|
+
- name: retainer_invoice_via_milestone
|
|
273
|
+
on: save
|
|
274
|
+
check: project == '' || project.billing_model != 'retainer' || billing_milestone != '' || kind == 'retention'
|
|
275
|
+
message: {id: 'Faktur proyek retainer dibuat dari termin bulanannya (satu termin, satu faktur per bulan)'}
|
|
276
|
+
- name: retainer_invoice_monthly
|
|
277
|
+
on: save
|
|
278
|
+
check: project == '' || project.billing_model != 'retainer' || billing_milestone == '' || billing_milestone.kind == 'retainer'
|
|
279
|
+
message: {id: 'Faktur proyek retainer hanya dari termin jenis Retainer (satu per bulan)'}
|
|
280
|
+
- name: retention_same_project
|
|
281
|
+
on: save
|
|
282
|
+
check: retention_of == '' || retention_of.project == project
|
|
283
|
+
message: {id: Faktur retensi harus untuk proyek yang sama dengan faktur asalnya}
|
|
284
|
+
- name: retainer_invoice_within_fee
|
|
285
|
+
on: save
|
|
286
|
+
check: project == '' || project.billing_model != 'retainer' || project.contract_value == 0 || dpp <= project.contract_value
|
|
287
|
+
message: {id: Faktur retainer tidak boleh melebihi fee bulanan (nilai kontrak)}
|
|
288
|
+
- name: milestone_ready_to_bill
|
|
289
|
+
on: save
|
|
290
|
+
check: billing_milestone == '' || billing_milestone.trigger != 'acceptance' || billing_milestone.state == 'ready' || (billing_milestone.sales_invoice != '' && billing_milestone.sales_invoice == name)
|
|
291
|
+
message: {id: Termin ini belum siap ditagih (berita acaranya belum ada atau sudah dibatalkan)}
|
|
292
|
+
- name: milestone_not_invoiced
|
|
293
|
+
on: save
|
|
294
|
+
check: billing_milestone == '' || billing_milestone.state != 'invoiced' || billing_milestone.sales_invoice == name
|
|
295
|
+
message: {id: Termin ini sudah ditagih di faktur lain}
|
|
296
|
+
- name: dp_base_above_lines
|
|
297
|
+
on: save
|
|
298
|
+
level: warn
|
|
299
|
+
check: "!pph23_applies || pph23_dp_base <= pph23_lines_base"
|
|
300
|
+
message: {id: 'Dasar PPh 23 di faktur uang muka lebih besar dari dasar baris faktur ini; pisahkan baris gaji di faktur DP juga'}
|
|
196
301
|
- name: acceptance_same_customer
|
|
197
302
|
on: save
|
|
198
303
|
check: acceptance == '' || acceptance.project.customer == customer
|
|
@@ -270,7 +375,7 @@ views:
|
|
|
270
375
|
layout:
|
|
271
376
|
- section: {id: Pelanggan}
|
|
272
377
|
columns:
|
|
273
|
-
- [kind, customer, po_number, customer_order, project]
|
|
378
|
+
- [kind, customer, po_number, customer_order, project, billing_milestone, salesman]
|
|
274
379
|
- [posting_date, due_date, outlet, acceptance]
|
|
275
380
|
- section: {id: Barang/jasa}
|
|
276
381
|
fields: [items]
|
|
@@ -32,6 +32,15 @@ fields:
|
|
|
32
32
|
type: currency
|
|
33
33
|
label: {id: Jumlah}
|
|
34
34
|
compute: round(qty * rate * (1 - discount / 100))
|
|
35
|
+
# PPh 23 is withheld on the fee for a service, not on what the firm passes through: the workers' wages billed on their
|
|
36
|
+
# own line (jasa tenaga kerja, PMK 141/2015) or a reimbursed cost. Ticked lines stay out of the invoice's PPh 23 base.
|
|
37
|
+
# The flag says "excluded" so that a line written before the field existed (NULL after migrate, read as false) keeps
|
|
38
|
+
# the old behaviour: part of the base.
|
|
39
|
+
- name: pph23_exclude
|
|
40
|
+
type: check
|
|
41
|
+
label: {id: Bukan dasar PPh 23}
|
|
42
|
+
help: {id: 'Centang untuk baris gaji tenaga kerja yang dirinci terpisah atau penggantian biaya'}
|
|
43
|
+
default: 'false'
|
|
35
44
|
|
|
36
45
|
- {name: rate_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Harga (valas)}, default: '0'}
|
|
37
46
|
- {name: amount_fx, type: money, currency_field: currency, rate_field: exchange_rate, label: {id: Jumlah (valas)}, compute: "round(qty * rate_fx * (1 - discount / 100), 2)"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
|
|
2
2
|
name: invoicing
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.3.0
|
|
4
4
|
title: {id: Faktur, en: Invoicing}
|
|
5
5
|
requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, catalogue: ^1.0}
|
|
6
|
-
optional: {outlets: ^1.0, tax_id: ^1.0, currency: ^1.0, orders: ^1.0, projects: ^1.0}
|
|
6
|
+
optional: {outlets: ^1.0, tax_id: ^1.0, currency: ^1.0, orders: ^1.0, projects: ^1.0, delivery: ^1.0}
|
|
7
7
|
# ledger.post_receivable is a core hook; this one is semantics fixed in docs/kernel-hooks.md.
|
|
8
8
|
# invoicing.from_order is declared by the orders module, where the make_invoice action lives.
|
|
9
9
|
hooks: [invoicing.reverse_receivable]
|
|
@@ -52,12 +52,13 @@
|
|
|
52
52
|
{{if taxrate .Doc .Tax}}<tr><td>PPN {{number (taxrate .Doc .Tax)}}% (DPP nilai lain {{.Doc.dpp_num}}/{{.Doc.dpp_den}})</td><td class="num">{{rupiah .Doc.ppn}}</td></tr>{{end}}
|
|
53
53
|
<tr class="grand"><td>Total</td><td class="num">{{rupiah .Doc.grand_total}}</td></tr>
|
|
54
54
|
{{if .Doc.retention_amount}}<tr><td>Retensi {{number .Doc.retention_percent}}% ditahan</td><td class="num">-{{rupiah .Doc.retention_amount}}</td></tr>{{end}}
|
|
55
|
-
{{if .Doc.pph23_amount}}<tr><td>PPh 23 dipotong pelanggan</td><td class="num">-{{rupiah .Doc.pph23_amount}}</td></tr>{{end}}
|
|
55
|
+
{{if .Doc.pph23_amount}}<tr><td>PPh 23 dipotong pelanggan{{if .Doc.pph23_dpp}} (dasar {{rupiah .Doc.pph23_dpp}}){{end}}</td><td class="num">-{{rupiah .Doc.pph23_amount}}</td></tr>{{end}}
|
|
56
56
|
{{if or .Doc.retention_amount .Doc.pph23_amount}}<tr class="grand"><td>Tagihan bersih</td><td class="num">{{rupiah .Doc.amount_due}}</td></tr>{{end}}
|
|
57
57
|
</table>
|
|
58
58
|
<p class="note"><strong>Terbilang:</strong> {{terbilang .Doc.grand_total}}</p>
|
|
59
59
|
{{if .Doc.notes}}<p class="note">{{.Doc.notes}}</p>{{end}}
|
|
60
60
|
<p class="note">Bila pembayaran dipotong PPh Pasal 23, mohon kirimkan bukti potongnya kepada kami.</p>
|
|
61
61
|
{{template "bank_accounts" .}}
|
|
62
|
+
{{if .Letterhead.bank}}<p class="note">Mohon tulis nomor faktur <strong>{{.Doc.name}}</strong> di berita transfer supaya pembayaran langsung tercatat.</p>{{end}}
|
|
62
63
|
{{if taxrate .Doc .Tax}}<p class="note">Faktur pajak (e-Faktur) diterbitkan terpisah.</p>{{end}}
|
|
63
64
|
{{template "signature" .}}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{{define "style"}}
|
|
2
|
+
.msg { white-space: pre-wrap; border: 1px solid #d6d3d1; border-radius: 8px; padding: 12px; margin: 12px 0; font-size: 1.05em; }
|
|
3
|
+
.wa { display: inline-block; padding: 8px 14px; border-radius: 6px; background: #128c7e; color: #fff; text-decoration: none; font-weight: 700; }
|
|
4
|
+
.muted { color: #78716c; font-size: 0.9em; }
|
|
5
|
+
{{end}}
|
|
6
|
+
{{- $c := .Links.customer -}}
|
|
7
|
+
{{- $p := "" -}}{{- with $c.phone -}}{{- $p = . -}}{{- end -}}
|
|
8
|
+
{{- if and $p (eq (slice $p 0 1) "+") -}}{{- $p = slice $p 1 -}}{{- end -}}
|
|
9
|
+
{{- if and $p (eq (slice $p 0 1) "0") -}}{{- $p = printf "62%s" (slice $p 1) -}}{{- end -}}
|
|
10
|
+
{{- $bank := "" -}}{{- with .Letterhead.bank -}}{{- with index . 0 -}}{{- $bank = printf "%s %s a.n. %s" .bank .account .holder -}}{{- end -}}{{- end -}}
|
|
11
|
+
{{- $late := overdue .Doc.due_date -}}
|
|
12
|
+
{{- $msg := "" -}}
|
|
13
|
+
{{- $open := eq (printf "%v" .Doc.docstatus) "1" -}}
|
|
14
|
+
{{- $owed := gt (printf "%v" .Doc.outstanding | len) 0 -}}{{- if $owed -}}{{- $owed = ne (slice (printf "%v" .Doc.outstanding) 0 1) "-" -}}{{- end -}}
|
|
15
|
+
{{- if not $open -}}
|
|
16
|
+
{{- $p = "" -}}
|
|
17
|
+
{{- if eq (printf "%v" .Doc.docstatus) "2" -}}
|
|
18
|
+
{{- $msg = printf "Faktur %s sudah dibatalkan. Tidak ada tagihan yang dikirim untuk faktur ini." .Doc.name -}}
|
|
19
|
+
{{- else -}}
|
|
20
|
+
{{- $msg = printf "Faktur %s belum diajukan. Ajukan dulu sebelum menagih pelanggan." .Doc.name -}}
|
|
21
|
+
{{- end -}}
|
|
22
|
+
{{- else if or (not .Doc.outstanding) (not $owed) -}}
|
|
23
|
+
{{- $msg = printf "Halo %s, terima kasih. Pembayaran faktur %s sudah kami terima dan faktur ini sudah lunas.\n\n%s" $c.customer_name .Doc.name .Letterhead.legal_name -}}
|
|
24
|
+
{{- else if gt $late 0 -}}
|
|
25
|
+
{{- $msg = printf "Halo %s, kami mengingatkan faktur %s sebesar %s sudah lewat %d hari dari jatuh tempo (%s).\n\nPembayaran ke %s. Mohon tulis %s di berita transfer.\n\nAbaikan pesan ini kalau sudah membayar. Terima kasih.\n%s" $c.customer_name .Doc.name (rupiah .Doc.outstanding) $late (date .Doc.due_date) $bank .Doc.name .Letterhead.legal_name -}}
|
|
26
|
+
{{- else -}}
|
|
27
|
+
{{- $msg = printf "Halo %s, berikut tagihan %s no. %s sebesar %s, jatuh tempo %s.\n\nPembayaran ke %s. Mohon tulis %s di berita transfer.\n\nTerima kasih." $c.customer_name .Letterhead.legal_name .Doc.name (rupiah .Doc.outstanding) (date .Doc.due_date) $bank .Doc.name -}}
|
|
28
|
+
{{- end -}}
|
|
29
|
+
<h1>Pesan tagihan WhatsApp</h1>
|
|
30
|
+
<p>Untuk: <strong>{{$c.customer_name}}</strong>{{if $p}} · +{{$p}}{{else if $open}} · <em>nomor WhatsApp pelanggan belum diisi</em>{{end}}</p>
|
|
31
|
+
<div class="msg">{{$msg}}</div>
|
|
32
|
+
{{if $p}}<p><a class="wa" href="https://wa.me/{{$p}}?text={{$msg}}">Buka di WhatsApp</a></p>{{end}}
|
|
33
|
+
<p class="muted">Setelah terkirim, catat di Pengingat tagihan supaya tidak menagih dua kali di hari yang sama.</p>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/print.json
|
|
2
|
+
# Not paper: the reminder text plus a wa.me link that opens WhatsApp with the text filled in, so the owner sends it
|
|
3
|
+
# from their own phone. Same wording as the WhatsApp Business templates in rangka-connectors.
|
|
4
|
+
name: sales_invoice_whatsapp
|
|
5
|
+
model: sales_invoice
|
|
6
|
+
label: {id: Pesan tagihan WA, en: WhatsApp reminder}
|
|
7
|
+
paper: A5
|
|
8
|
+
template: sales_invoice_whatsapp.html
|