@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,27 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: item_category
|
|
3
|
+
label: {id: Kategori barang, en: Item category}
|
|
4
|
+
icon: stock
|
|
5
|
+
naming: KTG-{###}
|
|
6
|
+
title_field: category_name
|
|
7
|
+
# Flat list (no tree): shops group items as "Minuman", "Sembako", "Rokok". Margin and sales per category are read
|
|
8
|
+
# from the item's category.
|
|
9
|
+
permissions:
|
|
10
|
+
- {role: sales_manager, read: true, create: true, write: true, print: true}
|
|
11
|
+
- {role: finance_manager, read: true, create: true, write: true, print: true}
|
|
12
|
+
- {role: purchasing_manager, read: true, create: true, write: true, print: true}
|
|
13
|
+
- {role: project_admin, read: true, create: true, write: true, print: true}
|
|
14
|
+
- {role: head_office, read: true, create: true, write: true, delete: true, print: true}
|
|
15
|
+
- {role: outlet_staff, read: true}
|
|
16
|
+
- {role: sales_rep, read: true}
|
|
17
|
+
- {role: field_sales, read: true}
|
|
18
|
+
fields:
|
|
19
|
+
- name: category_name
|
|
20
|
+
type: data
|
|
21
|
+
label: {id: Nama kategori}
|
|
22
|
+
required: true
|
|
23
|
+
in_list: true
|
|
24
|
+
unique: true
|
|
25
|
+
- name: notes
|
|
26
|
+
type: text
|
|
27
|
+
label: {id: Catatan}
|
|
@@ -5,6 +5,7 @@ icon: stock
|
|
|
5
5
|
naming: UOM-{###}
|
|
6
6
|
title_field: uom_name
|
|
7
7
|
permissions:
|
|
8
|
+
- {role: field_sales, read: true}
|
|
8
9
|
- {role: sales_manager, read: true, create: true, write: true, print: true}
|
|
9
10
|
- {role: finance_manager, read: true, create: true, write: true, print: true}
|
|
10
11
|
- {role: purchasing_manager, read: true, create: true, write: true, print: true}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
|
|
2
2
|
name: catalogue
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.1.0
|
|
4
4
|
title: {id: Katalog, en: Catalogue}
|
|
5
5
|
requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0}
|
|
6
|
+
optional: {production: ^1.0}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: consignment_bill
|
|
3
|
+
label: {id: Tagihan setoran titipan}
|
|
4
|
+
# Runs in the submitter's transaction (rangka-os #34). One live vendor_bill per consignor and bill_ref (month); only one
|
|
5
|
+
# settlement per consignor and month can be live (period_key), so:
|
|
6
|
+
# - no bill yet: a draft bill with one line per item sold (qty_sold x rate);
|
|
7
|
+
# - a draft bill left by a cancelled settlement of that month: its lines are replaced by this (amended) settlement's;
|
|
8
|
+
# - a submitted bill: nothing is created; head office is told to check it, so a payable is never written twice.
|
|
9
|
+
on: consignment_settlement.submitted
|
|
10
|
+
if: event.total > 0
|
|
11
|
+
steps:
|
|
12
|
+
- {find: vendor_bill, where: "vendor == event.consignor && bill_no == event.bill_ref && docstatus != 2", as: bill}
|
|
13
|
+
- create: vendor_bill
|
|
14
|
+
if: bill == null
|
|
15
|
+
set:
|
|
16
|
+
vendor: event.consignor
|
|
17
|
+
bill_no: event.bill_ref
|
|
18
|
+
bill_date: today()
|
|
19
|
+
items: "event.items.filter(i, i.qty_sold > 0).map(i, {'item': i.item, 'qty': i.qty_sold, 'rate': i.rate})"
|
|
20
|
+
as: created
|
|
21
|
+
- update: bill
|
|
22
|
+
if: bill != null && bill.docstatus == 0
|
|
23
|
+
set:
|
|
24
|
+
items: "event.items.filter(i, i.qty_sold > 0).map(i, {'item': i.item, 'qty': i.qty_sold, 'rate': i.rate})"
|
|
25
|
+
- notify: head_office
|
|
26
|
+
if: bill == null
|
|
27
|
+
channel: in_app
|
|
28
|
+
template: {id: 'Setoran titipan {event.name} jadi draf tagihan {created.name}, cek lalu ajukan'}
|
|
29
|
+
- notify: head_office
|
|
30
|
+
if: bill != null && bill.docstatus == 0
|
|
31
|
+
channel: in_app
|
|
32
|
+
template: {id: 'Draf tagihan {bill.name} diperbarui dari setoran titipan {event.name}'}
|
|
33
|
+
- notify: head_office
|
|
34
|
+
if: bill != null && bill.docstatus == 1
|
|
35
|
+
channel: in_app
|
|
36
|
+
template: {id: 'Tagihan {bill.name} untuk periode ini sudah diajukan. Batalkan dulu tagihan itu, lalu ajukan ulang setoran {event.name}'}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
name: consignment_bill_cancelled
|
|
3
|
+
label: {id: Setoran titipan dibatalkan}
|
|
4
|
+
# Runs in the canceller's transaction. While the month's bill is submitted the cancel is refused: the update step
|
|
5
|
+
# writes to a submitted vendor_bill, which the engine refuses, and that rolls the cancel back. Cancel (or pay back)
|
|
6
|
+
# the bill first, then the settlement; its amended copy then makes a new draft bill. A draft bill is left for the
|
|
7
|
+
# amended settlement to fill.
|
|
8
|
+
on: consignment_settlement.cancelled
|
|
9
|
+
steps:
|
|
10
|
+
- {find: vendor_bill, where: "vendor == event.consignor && bill_no == event.bill_ref && docstatus == 1", as: bill}
|
|
11
|
+
- update: bill
|
|
12
|
+
if: bill != null
|
|
13
|
+
set:
|
|
14
|
+
notes: "'Batalkan tagihan ini dulu sebelum setoran titipan ' + event.name + ' dibatalkan'"
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: consignment_settlement
|
|
3
|
+
label: {id: Setoran titipan, en: Consignment settlement}
|
|
4
|
+
icon: invoice
|
|
5
|
+
is_submittable: true
|
|
6
|
+
naming: KNS-{YYYY}-{####}
|
|
7
|
+
title_field: consignor
|
|
8
|
+
# One consignor, one month, all outlets. Per item: received, sold and returned in the month, and what is left on the
|
|
9
|
+
# shelf; the shop owes qty_sold x rate. Submitting creates a draft vendor_bill for the consignor (flow consignment_bill),
|
|
10
|
+
# which head office checks, submits and pays. One settlement per consignor and month (period_key is unique; an amended
|
|
11
|
+
# copy carries amended_from, so a cancelled settlement can be amended), so two settlements can never bill one month.
|
|
12
|
+
# A settlement whose bill is submitted cannot be cancelled (flow consignment_bill_cancelled): cancel the bill first. qty_sold is typed from the "Titipan terjual" list of the retail dashboard;
|
|
13
|
+
# filling it from the stock moves needs a kernel hook (draft contract 0021, K-o).
|
|
14
|
+
# No delete for head office: deleting a cancelled settlement would free its month's key while its amended copy is
|
|
15
|
+
# live, and a second settlement of that month would then go unbilled. Only the owner may delete.
|
|
16
|
+
permissions:
|
|
17
|
+
- {role: head_office, read: true, create: true, write: true, submit: true, cancel: true, amend: true, export: true, print: true}
|
|
18
|
+
fields:
|
|
19
|
+
- name: consignor
|
|
20
|
+
type: link
|
|
21
|
+
to: vendor
|
|
22
|
+
label: {id: Penitip}
|
|
23
|
+
required: true
|
|
24
|
+
in_list: true
|
|
25
|
+
- name: month
|
|
26
|
+
type: data
|
|
27
|
+
label: {id: Bulan}
|
|
28
|
+
help: {id: 'Format TTTT-BB, misalnya 2026-10'}
|
|
29
|
+
required: true
|
|
30
|
+
in_list: true
|
|
31
|
+
- name: items
|
|
32
|
+
type: table
|
|
33
|
+
of: consignment_settlement_item
|
|
34
|
+
label: {id: Barang titipan}
|
|
35
|
+
min_rows: 1
|
|
36
|
+
- name: qty_sold_total
|
|
37
|
+
type: float
|
|
38
|
+
label: {id: Total terjual}
|
|
39
|
+
compute: items.map(i, i.qty_sold).sum()
|
|
40
|
+
- name: total
|
|
41
|
+
type: currency
|
|
42
|
+
label: {id: Nilai setor}
|
|
43
|
+
compute: items.map(i, i.amount).sum()
|
|
44
|
+
in_list: true
|
|
45
|
+
- name: notes
|
|
46
|
+
type: text
|
|
47
|
+
label: {id: Catatan}
|
|
48
|
+
# The bill number of this consignor and month: the flow keeps one live vendor_bill per bill_ref.
|
|
49
|
+
- name: bill_ref
|
|
50
|
+
type: data
|
|
51
|
+
label: {id: Nomor tagihan titipan}
|
|
52
|
+
compute: "'TTP/' + month"
|
|
53
|
+
in_list: true
|
|
54
|
+
- name: period_key
|
|
55
|
+
type: data
|
|
56
|
+
label: {id: Kunci periode}
|
|
57
|
+
compute: "consignor + '|' + month + (amended_from == '' ? '' : '|' + amended_from)"
|
|
58
|
+
unique: true
|
|
59
|
+
rules:
|
|
60
|
+
- name: month_format
|
|
61
|
+
on: save
|
|
62
|
+
check: "month.matches('^20[0-9]{2}-(0[1-9]|1[0-2])$')"
|
|
63
|
+
message: {id: 'Bulan ditulis TTTT-BB, misalnya 2026-10'}
|
|
64
|
+
- name: qty_not_negative
|
|
65
|
+
on: save
|
|
66
|
+
check: "items.map(i, i.qty_received < 0 || i.qty_sold < 0 || i.qty_returned < 0 ? 1 : 0).sum() == 0"
|
|
67
|
+
message: {id: Jumlah barang tidak boleh negatif}
|
|
68
|
+
- name: rate_for_sold_items
|
|
69
|
+
on: save
|
|
70
|
+
check: "items.map(i, i.qty_sold > 0 && i.rate <= 0 ? 1 : 0).sum() == 0"
|
|
71
|
+
message: {id: 'Harga setor wajib diisi untuk barang yang terjual'}
|
|
72
|
+
- name: sold_within_stock
|
|
73
|
+
on: save
|
|
74
|
+
check: "items.map(i, i.qty_left < 0 ? 1 : 0).sum() == 0"
|
|
75
|
+
message: {id: 'Terjual ditambah dikembalikan melebihi stok awal ditambah diterima'}
|
|
76
|
+
views:
|
|
77
|
+
list:
|
|
78
|
+
columns: [name, consignor, month, status, total, bill_ref]
|
|
79
|
+
filters: [consignor]
|
|
80
|
+
sort: -month
|
|
81
|
+
form:
|
|
82
|
+
layout:
|
|
83
|
+
- section: {id: Setoran titipan}
|
|
84
|
+
columns:
|
|
85
|
+
- [consignor, month]
|
|
86
|
+
- [bill_ref]
|
|
87
|
+
- section: {id: Barang titipan}
|
|
88
|
+
fields: [items]
|
|
89
|
+
- section: {id: Ringkasan}
|
|
90
|
+
columns:
|
|
91
|
+
- [qty_sold_total, total]
|
|
92
|
+
- section: {id: Catatan}
|
|
93
|
+
fields: [notes]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/model.json
|
|
2
|
+
name: consignment_settlement_item
|
|
3
|
+
is_child: true
|
|
4
|
+
fields:
|
|
5
|
+
- name: item
|
|
6
|
+
type: link
|
|
7
|
+
to: item
|
|
8
|
+
label: {id: Barang}
|
|
9
|
+
required: true
|
|
10
|
+
- name: qty_opening
|
|
11
|
+
type: float
|
|
12
|
+
label: {id: Stok awal periode}
|
|
13
|
+
default: '0'
|
|
14
|
+
- name: qty_received
|
|
15
|
+
type: float
|
|
16
|
+
label: {id: Diterima}
|
|
17
|
+
default: '0'
|
|
18
|
+
- name: qty_sold
|
|
19
|
+
type: float
|
|
20
|
+
label: {id: Terjual}
|
|
21
|
+
required: true
|
|
22
|
+
- name: qty_returned
|
|
23
|
+
type: float
|
|
24
|
+
label: {id: Dikembalikan}
|
|
25
|
+
default: '0'
|
|
26
|
+
- name: qty_left
|
|
27
|
+
type: float
|
|
28
|
+
label: {id: Sisa di rak}
|
|
29
|
+
compute: qty_opening + qty_received - qty_sold - qty_returned
|
|
30
|
+
- name: rate
|
|
31
|
+
type: currency
|
|
32
|
+
label: {id: Harga setor}
|
|
33
|
+
default: item.consignment_cost
|
|
34
|
+
- name: amount
|
|
35
|
+
type: currency
|
|
36
|
+
label: {id: Jumlah}
|
|
37
|
+
compute: round(qty_sold * rate)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/module.json
|
|
2
|
+
# Consignment in (barang titipan): a shop sells goods a supplier still owns and pays for what sold, usually monthly.
|
|
3
|
+
# The goods come in through goods_receipt from the consignor (stock moves, no payable: payables come only from
|
|
4
|
+
# vendor_bill); item.consignor and item.consignment_cost (catalogue) mark them. Unsold goods go back through
|
|
5
|
+
# stock_adjustment with reason consignment_return. The monthly settlement becomes a draft vendor_bill (flow
|
|
6
|
+
# consignment_bill), so it is paid like any other bill.
|
|
7
|
+
name: consignment
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
title: {id: Konsinyasi, en: Consignment}
|
|
10
|
+
requires: {rangka: '>=0.5', users: ^1.0, contacts: ^1.0, catalogue: ^1.0, outlets: ^1.0, stock: ^1.0, procurement: ^1.0}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
|
|
2
|
+
# The opening customer list: one row per customer. WhatsApp numbers in +62 form, NPWP 16 digits (may be empty).
|
|
3
|
+
# Duplicates are detected against earlier imports only (contract 0012): a customer typed in by hand with the same name is
|
|
4
|
+
# not matched and would be created again; check the list before importing into an installation that is already in use.
|
|
5
|
+
name: customer_list
|
|
6
|
+
label: {id: Daftar pelanggan, en: Customer list}
|
|
7
|
+
model: customer
|
|
8
|
+
source: csv
|
|
9
|
+
header_row: 1
|
|
10
|
+
key: [Nama pelanggan]
|
|
11
|
+
map:
|
|
12
|
+
customer_name: Nama pelanggan
|
|
13
|
+
city: Kota
|
|
14
|
+
phone: WhatsApp
|
|
15
|
+
email: Email
|
|
16
|
+
payment_days: Tempo (hari)
|
|
17
|
+
npwp: NPWP
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/import.json
|
|
2
|
+
# The opening supplier list: one row per supplier.
|
|
3
|
+
# Duplicates are detected against earlier imports only (contract 0012): a supplier typed in by hand with the same name is
|
|
4
|
+
# not matched and would be created again; check the list before importing into an installation that is already in use.
|
|
5
|
+
name: vendor_list
|
|
6
|
+
label: {id: Daftar pemasok, en: Supplier list}
|
|
7
|
+
model: vendor
|
|
8
|
+
source: csv
|
|
9
|
+
header_row: 1
|
|
10
|
+
key: [Nama pemasok]
|
|
11
|
+
map:
|
|
12
|
+
vendor_name: Nama pemasok
|
|
13
|
+
city: Kota
|
|
14
|
+
phone: WhatsApp
|
|
15
|
+
payment_days: Tempo (hari)
|
|
16
|
+
npwp: NPWP
|
|
@@ -12,6 +12,8 @@ permissions:
|
|
|
12
12
|
- {role: head_office, read: true, create: true, write: true, print: true}
|
|
13
13
|
- {role: outlet_staff, read: true}
|
|
14
14
|
- {role: sales_rep, read: true, create: true, write: true}
|
|
15
|
+
# a salesman sees his own customers (role scope salesman) and cannot change their credit
|
|
16
|
+
- {role: field_sales, read: true}
|
|
15
17
|
fields:
|
|
16
18
|
- name: customer_name
|
|
17
19
|
type: data
|
|
@@ -45,6 +47,57 @@ fields:
|
|
|
45
47
|
label: {id: Piutang}
|
|
46
48
|
read_only: true
|
|
47
49
|
in_list: true
|
|
50
|
+
# Distributor sales (module distribution): the salesman who visits the customer, the route, the price tier, and
|
|
51
|
+
# the credit control that holds its orders (customer_order approvals). oldest_open_due is the earliest due date of
|
|
52
|
+
# its open invoices, kept by the distribution flows; an order is held while it is before today.
|
|
53
|
+
- name: salesman
|
|
54
|
+
type: link
|
|
55
|
+
to: user
|
|
56
|
+
label: {id: Salesman}
|
|
57
|
+
in_list: true
|
|
58
|
+
depends_on: app_installed('distribution')
|
|
59
|
+
- name: route_day
|
|
60
|
+
type: select
|
|
61
|
+
label: {id: Hari kunjungan}
|
|
62
|
+
depends_on: app_installed('distribution')
|
|
63
|
+
options:
|
|
64
|
+
- {value: mon_thu, label: {id: Senin dan Kamis}}
|
|
65
|
+
- {value: tue_fri, label: {id: Selasa dan Jumat}}
|
|
66
|
+
- {value: wed_sat, label: {id: Rabu dan Sabtu}}
|
|
67
|
+
- {value: daily, label: {id: Setiap hari}}
|
|
68
|
+
- name: price_tier
|
|
69
|
+
type: select
|
|
70
|
+
label: {id: Tier harga}
|
|
71
|
+
default: "'retail'"
|
|
72
|
+
depends_on: app_installed('distribution')
|
|
73
|
+
options:
|
|
74
|
+
- {value: retail, label: {id: Eceran}}
|
|
75
|
+
- {value: wholesale, label: {id: Grosir}}
|
|
76
|
+
- {value: agent, label: {id: Agen}}
|
|
77
|
+
- name: credit_hold
|
|
78
|
+
type: check
|
|
79
|
+
label: {id: Tahan kredit}
|
|
80
|
+
help: {id: Semua pesanan pelanggan ini butuh persetujuan sampai dicentang lagi}
|
|
81
|
+
depends_on: app_installed('distribution')
|
|
82
|
+
- name: credit_hold_reason
|
|
83
|
+
type: data
|
|
84
|
+
label: {id: Alasan tahan kredit}
|
|
85
|
+
depends_on: app_installed('distribution')
|
|
86
|
+
- name: oldest_open_due
|
|
87
|
+
type: date
|
|
88
|
+
label: {id: Jatuh tempo tertua yang belum lunas}
|
|
89
|
+
read_only: true
|
|
90
|
+
depends_on: app_installed('distribution')
|
|
91
|
+
- name: open_orders
|
|
92
|
+
type: currency
|
|
93
|
+
label: {id: Pesanan belum ditagih (dengan PPN)}
|
|
94
|
+
read_only: true
|
|
95
|
+
depends_on: app_installed('distribution')
|
|
96
|
+
- name: uninvoiced_deliveries
|
|
97
|
+
type: currency
|
|
98
|
+
label: {id: Terkirim belum ditagih (dengan PPN)}
|
|
99
|
+
read_only: true
|
|
100
|
+
depends_on: app_installed('delivery')
|
|
48
101
|
- name: npwp
|
|
49
102
|
type: npwp
|
|
50
103
|
label: {id: NPWP}
|
|
@@ -66,7 +119,11 @@ views:
|
|
|
66
119
|
- [npwp, phone, email]
|
|
67
120
|
- section: {id: Pembayaran}
|
|
68
121
|
columns:
|
|
69
|
-
- [payment_days]
|
|
122
|
+
- [payment_days, price_tier]
|
|
70
123
|
- [credit_limit, outstanding]
|
|
124
|
+
- section: {id: Kredit dan salesman}
|
|
125
|
+
columns:
|
|
126
|
+
- [salesman, route_day, credit_hold, credit_hold_reason]
|
|
127
|
+
- [open_orders, uninvoiced_deliveries, oldest_open_due]
|
|
71
128
|
- section: {id: Kontak person}
|
|
72
129
|
fields: [contacts]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Inside a delivery note's cancel: refused while a live sales return comes from it (its stock would be counted back
|
|
3
|
+
# twice), or while the order would have invoiced more than it delivered (an invoice billing goods never sent).
|
|
4
|
+
name: delivery_cancel_guard
|
|
5
|
+
label: {id: Surat jalan yang sudah diretur atau ditagih tidak bisa dibatalkan}
|
|
6
|
+
on: delivery_note.cancelled
|
|
7
|
+
steps:
|
|
8
|
+
- {find: sales_return, where: delivery_note == event.name && docstatus == 1, as: ret}
|
|
9
|
+
- {find: order_fulfilment, where: name == event.fulfilment, as: f}
|
|
10
|
+
- update: f
|
|
11
|
+
if: f != null
|
|
12
|
+
set: {customer: f.customer}
|
|
13
|
+
- if: ret != null
|
|
14
|
+
create: delivery_guard
|
|
15
|
+
set: {reason: "'note_returned'", document: ret.name}
|
|
16
|
+
- if: "ret == null && f != null && f.items.map(b, b.delivered_qty - event.items.map(l, l.item == b.item ? l.qty : 0).sum() + 0.0005 < b.invoiced_qty ? 1 : 0).sum() > 0"
|
|
17
|
+
create: delivery_guard
|
|
18
|
+
set: {reason: "'note_invoiced'", document: event.name}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Keeps order_fulfilment current on delivery_note.cancelled: one line per item of the order, summed over the event lines of that item.
|
|
3
|
+
name: fulfilment_on_delivery_cancelled
|
|
4
|
+
label: {id: Perbarui pemenuhan pesanan}
|
|
5
|
+
on: delivery_note.cancelled
|
|
6
|
+
if: "event.fulfilment != ''"
|
|
7
|
+
steps:
|
|
8
|
+
- {find: order_fulfilment, where: name == event.fulfilment, as: f}
|
|
9
|
+
# a find returns the record without its table rows: an update that changes nothing returns it whole
|
|
10
|
+
- update: f
|
|
11
|
+
if: f != null
|
|
12
|
+
set: {customer: f.customer}
|
|
13
|
+
- update: f
|
|
14
|
+
if: f != null
|
|
15
|
+
set:
|
|
16
|
+
items: "f.items.map(b, {'name': b.name, 'item': b.item, 'ordered_qty': b.ordered_qty, 'rate': b.rate, 'delivered_qty': b.delivered_qty - event.items.map(l, l.item == b.item ? l.qty : 0).sum(), 'returned_qty': b.returned_qty, 'invoiced_qty': b.invoiced_qty})"
|
|
17
|
+
- {find_all: order_fulfilment, where: "f != null && customer == f.customer", as: all}
|
|
18
|
+
- {find: customer, where: "f != null && name == f.customer", as: cust}
|
|
19
|
+
- update: cust
|
|
20
|
+
if: cust != null
|
|
21
|
+
set: {uninvoiced_deliveries: "all.map(x, x.uninvoiced_value).sum()"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Keeps order_fulfilment current on delivery_note.submitted: one line per item of the order, summed over the event lines of that item.
|
|
3
|
+
name: fulfilment_on_delivery_submitted
|
|
4
|
+
label: {id: Perbarui pemenuhan pesanan}
|
|
5
|
+
on: delivery_note.submitted
|
|
6
|
+
if: "event.fulfilment != ''"
|
|
7
|
+
steps:
|
|
8
|
+
- {find: order_fulfilment, where: name == event.fulfilment, as: f}
|
|
9
|
+
# a find returns the record without its table rows: an update that changes nothing returns it whole
|
|
10
|
+
- update: f
|
|
11
|
+
if: f != null
|
|
12
|
+
set: {customer: f.customer}
|
|
13
|
+
- update: f
|
|
14
|
+
if: f != null
|
|
15
|
+
set:
|
|
16
|
+
items: "f.items.map(b, {'name': b.name, 'item': b.item, 'ordered_qty': b.ordered_qty, 'rate': b.rate, 'delivered_qty': b.delivered_qty + event.items.map(l, l.item == b.item ? l.qty : 0).sum(), 'returned_qty': b.returned_qty, 'invoiced_qty': b.invoiced_qty})"
|
|
17
|
+
- {find_all: order_fulfilment, where: "f != null && customer == f.customer", as: all}
|
|
18
|
+
- {find: customer, where: "f != null && name == f.customer", as: cust}
|
|
19
|
+
- update: cust
|
|
20
|
+
if: cust != null
|
|
21
|
+
set: {uninvoiced_deliveries: "all.map(x, x.uninvoiced_value).sum()"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Keeps order_fulfilment current on sales_invoice.cancelled: one line per item of the order, summed over the event lines of that item.
|
|
3
|
+
name: fulfilment_on_invoice_cancelled
|
|
4
|
+
label: {id: Perbarui pemenuhan pesanan}
|
|
5
|
+
on: sales_invoice.cancelled
|
|
6
|
+
if: "event.customer_order != ''"
|
|
7
|
+
steps:
|
|
8
|
+
- {find: customer_order, where: name == event.customer_order, as: so}
|
|
9
|
+
- {find: order_fulfilment, where: "so != null && name == so.fulfilment", as: f}
|
|
10
|
+
# a find returns the record without its table rows: an update that changes nothing returns it whole
|
|
11
|
+
- update: f
|
|
12
|
+
if: f != null
|
|
13
|
+
set: {customer: f.customer}
|
|
14
|
+
- update: f
|
|
15
|
+
if: f != null
|
|
16
|
+
set:
|
|
17
|
+
items: "f.items.map(b, {'name': b.name, 'item': b.item, 'ordered_qty': b.ordered_qty, 'rate': b.rate, 'delivered_qty': b.delivered_qty, 'returned_qty': b.returned_qty, 'invoiced_qty': b.invoiced_qty - event.items.map(l, l.item == b.item ? l.qty : 0).sum()})"
|
|
18
|
+
- {find_all: order_fulfilment, where: "f != null && customer == f.customer", as: all}
|
|
19
|
+
- {find: customer, where: "f != null && name == f.customer", as: cust}
|
|
20
|
+
- update: cust
|
|
21
|
+
if: cust != null
|
|
22
|
+
set: {uninvoiced_deliveries: "all.map(x, x.uninvoiced_value).sum()"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Keeps order_fulfilment current on sales_invoice.submitted: one line per item of the order, summed over the event lines of that item.
|
|
3
|
+
name: fulfilment_on_invoice_submitted
|
|
4
|
+
label: {id: Perbarui pemenuhan pesanan}
|
|
5
|
+
on: sales_invoice.submitted
|
|
6
|
+
if: "event.customer_order != ''"
|
|
7
|
+
steps:
|
|
8
|
+
- {find: customer_order, where: name == event.customer_order, as: so}
|
|
9
|
+
- {find: order_fulfilment, where: "so != null && name == so.fulfilment", as: f}
|
|
10
|
+
# a find returns the record without its table rows: an update that changes nothing returns it whole
|
|
11
|
+
- update: f
|
|
12
|
+
if: f != null
|
|
13
|
+
set: {customer: f.customer}
|
|
14
|
+
- update: f
|
|
15
|
+
if: f != null
|
|
16
|
+
set:
|
|
17
|
+
items: "f.items.map(b, {'name': b.name, 'item': b.item, 'ordered_qty': b.ordered_qty, 'rate': b.rate, 'delivered_qty': b.delivered_qty, 'returned_qty': b.returned_qty, 'invoiced_qty': b.invoiced_qty + event.items.map(l, l.item == b.item ? l.qty : 0).sum()})"
|
|
18
|
+
- {find_all: order_fulfilment, where: "f != null && customer == f.customer", as: all}
|
|
19
|
+
- {find: customer, where: "f != null && name == f.customer", as: cust}
|
|
20
|
+
- update: cust
|
|
21
|
+
if: cust != null
|
|
22
|
+
set: {uninvoiced_deliveries: "all.map(x, x.uninvoiced_value).sum()"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Every new draft order gets its own fulfilment record, linked from the order while it is a draft. An amended copy
|
|
3
|
+
# (whose read_only link is emptied by amend) or an order from before the module gets one on its next save
|
|
4
|
+
# (fulfilment_on_order_updated); the order cannot be submitted without one (rule has_fulfilment).
|
|
5
|
+
name: fulfilment_on_order_created
|
|
6
|
+
label: {id: Buat pemenuhan pesanan}
|
|
7
|
+
on: customer_order.created
|
|
8
|
+
steps:
|
|
9
|
+
- {find: customer_order, where: name == event.name, as: so}
|
|
10
|
+
- create: order_fulfilment
|
|
11
|
+
set:
|
|
12
|
+
customer_order: event.name
|
|
13
|
+
customer: event.customer
|
|
14
|
+
salesman: event.salesman
|
|
15
|
+
items: "event.items.map(i, {'item': i.item, 'ordered_qty': i.qty, 'rate': i.rate, 'delivered_qty': 0, 'returned_qty': 0, 'invoiced_qty': 0})"
|
|
16
|
+
as: f
|
|
17
|
+
- update: so
|
|
18
|
+
set: {fulfilment: f.name}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# The order is final when submitted: its lines (quantities and prices after tier pricing) become what was ordered,
|
|
3
|
+
# and the link follows the order's submitted name (the draft was DRAFT-xxxx).
|
|
4
|
+
name: fulfilment_on_order_submitted
|
|
5
|
+
label: {id: Pesanan diajukan jadi dasar pemenuhan}
|
|
6
|
+
on: customer_order.submitted
|
|
7
|
+
if: event.fulfilment != ''
|
|
8
|
+
steps:
|
|
9
|
+
- {find: order_fulfilment, where: name == event.fulfilment, as: f}
|
|
10
|
+
- update: f
|
|
11
|
+
if: f != null
|
|
12
|
+
set:
|
|
13
|
+
customer_order: event.name
|
|
14
|
+
customer: event.customer
|
|
15
|
+
salesman: event.salesman
|
|
16
|
+
items: "event.items.map(i, {'item': i.item, 'ordered_qty': i.qty, 'rate': i.rate, 'delivered_qty': 0, 'returned_qty': 0, 'invoiced_qty': 0})"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Every new draft order gets its own fulfilment record, linked from the order while it is a draft. An amended copy
|
|
3
|
+
# (whose read_only link is emptied by amend) or an order from before the module gets one on its next save
|
|
4
|
+
# (fulfilment_on_order_updated); the order cannot be submitted without one (rule has_fulfilment).
|
|
5
|
+
name: fulfilment_on_order_updated
|
|
6
|
+
label: {id: Buat pemenuhan pesanan}
|
|
7
|
+
on: customer_order.updated
|
|
8
|
+
if: event.docstatus == 0 && event.fulfilment == ''
|
|
9
|
+
steps:
|
|
10
|
+
- {find: customer_order, where: name == event.name, as: so}
|
|
11
|
+
- create: order_fulfilment
|
|
12
|
+
set:
|
|
13
|
+
customer_order: event.name
|
|
14
|
+
customer: event.customer
|
|
15
|
+
salesman: event.salesman
|
|
16
|
+
items: "event.items.map(i, {'item': i.item, 'ordered_qty': i.qty, 'rate': i.rate, 'delivered_qty': 0, 'returned_qty': 0, 'invoiced_qty': 0})"
|
|
17
|
+
as: f
|
|
18
|
+
- update: so
|
|
19
|
+
set: {fulfilment: f.name}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Keeps order_fulfilment current on sales_return.cancelled: one line per item of the order, summed over the event lines of that item.
|
|
3
|
+
name: fulfilment_on_return_cancelled
|
|
4
|
+
label: {id: Perbarui pemenuhan pesanan}
|
|
5
|
+
on: sales_return.cancelled
|
|
6
|
+
if: "event.fulfilment != ''"
|
|
7
|
+
steps:
|
|
8
|
+
- {find: order_fulfilment, where: name == event.fulfilment, as: f}
|
|
9
|
+
# a find returns the record without its table rows: an update that changes nothing returns it whole
|
|
10
|
+
- update: f
|
|
11
|
+
if: f != null
|
|
12
|
+
set: {customer: f.customer}
|
|
13
|
+
- update: f
|
|
14
|
+
if: f != null
|
|
15
|
+
set:
|
|
16
|
+
items: "f.items.map(b, {'name': b.name, 'item': b.item, 'ordered_qty': b.ordered_qty, 'rate': b.rate, 'delivered_qty': b.delivered_qty, 'returned_qty': b.returned_qty - event.items.map(l, l.item == b.item ? l.qty : 0).sum(), 'invoiced_qty': b.invoiced_qty})"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Keeps order_fulfilment current on sales_return.submitted: one line per item of the order, summed over the event lines of that item.
|
|
3
|
+
name: fulfilment_on_return_submitted
|
|
4
|
+
label: {id: Perbarui pemenuhan pesanan}
|
|
5
|
+
on: sales_return.submitted
|
|
6
|
+
if: "event.fulfilment != ''"
|
|
7
|
+
steps:
|
|
8
|
+
- {find: order_fulfilment, where: name == event.fulfilment, as: f}
|
|
9
|
+
# a find returns the record without its table rows: an update that changes nothing returns it whole
|
|
10
|
+
- update: f
|
|
11
|
+
if: f != null
|
|
12
|
+
set: {customer: f.customer}
|
|
13
|
+
- update: f
|
|
14
|
+
if: f != null
|
|
15
|
+
set:
|
|
16
|
+
items: "f.items.map(b, {'name': b.name, 'item': b.item, 'ordered_qty': b.ordered_qty, 'rate': b.rate, 'delivered_qty': b.delivered_qty, 'returned_qty': b.returned_qty + event.items.map(l, l.item == b.item ? l.qty : 0).sum(), 'invoiced_qty': b.invoiced_qty})"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# An invoice drafted from an order (invoicing.from_order) bills what the order still has open; a distributor bills
|
|
3
|
+
# what was delivered. This sets each line to what was delivered, less returns and earlier invoices, and drops the
|
|
4
|
+
# lines with nothing to bill. The rule invoice_within_delivered on sales_invoice checks it again at submit.
|
|
5
|
+
name: invoice_qty_from_deliveries
|
|
6
|
+
label: {id: Faktur sesuai barang yang dikirim}
|
|
7
|
+
on: sales_invoice.created
|
|
8
|
+
if: "event.customer_order != '' && event.docstatus == 0"
|
|
9
|
+
steps:
|
|
10
|
+
- {find: customer_order, where: name == event.customer_order, as: so}
|
|
11
|
+
- {find: order_fulfilment, where: "so != null && name == so.fulfilment", as: f}
|
|
12
|
+
# a find returns the record without its table rows: an update that changes nothing returns it whole
|
|
13
|
+
- update: f
|
|
14
|
+
if: f != null
|
|
15
|
+
set: {customer: f.customer}
|
|
16
|
+
- {find: sales_invoice, where: name == event.name, as: inv}
|
|
17
|
+
- update: inv
|
|
18
|
+
if: f != null
|
|
19
|
+
set:
|
|
20
|
+
items: "event.items.filter(l, f.items.map(b, b.item == l.item ? b.delivered_qty - b.invoiced_qty : 0).sum() > 0.0005).map(l, {'name': l.name, 'item': l.item, 'description': l.description, 'uom': l.uom, 'rate': l.rate, 'discount': l.discount, 'pph23_exclude': l.pph23_exclude, 'rate_fx': l.rate_fx, 'qty': min(l.qty, f.items.map(b, b.item == l.item ? b.delivered_qty - b.invoiced_qty : 0).sum())})"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Inside an order's cancel: refused while a live delivery note delivers it, or the amended copy would deliver it again.
|
|
3
|
+
name: order_cancel_guard
|
|
4
|
+
label: {id: Pesanan yang sudah dikirim tidak bisa dibatalkan}
|
|
5
|
+
on: customer_order.cancelled
|
|
6
|
+
steps:
|
|
7
|
+
- {find: delivery_note, where: customer_order == event.name && docstatus == 1, as: dn}
|
|
8
|
+
- if: dn != null
|
|
9
|
+
create: delivery_guard
|
|
10
|
+
set: {reason: "'order_delivered'", document: dn.name}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# Inside a sales return's cancel: refused while live payments "Potong retur" credit it (return_credit), or the goods
|
|
3
|
+
# would leave stock again while the credit stays.
|
|
4
|
+
name: return_cancel_guard
|
|
5
|
+
label: {id: Retur yang sudah dipotongkan tidak bisa dibatalkan}
|
|
6
|
+
on: sales_return.cancelled
|
|
7
|
+
steps:
|
|
8
|
+
- {find: return_credit, where: sales_return == event.name, as: rc}
|
|
9
|
+
- if: rc != null && rc.credited > 0
|
|
10
|
+
create: delivery_guard
|
|
11
|
+
set: {reason: "'return_credited'", document: event.name}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://rangka-os.github.io/rangka-os/schema/0.5/flow.json
|
|
2
|
+
# A payment "Potong retur" is cancelled: its amount comes off the return's credit.
|
|
3
|
+
name: return_credit_on_payment_cancelled
|
|
4
|
+
label: {id: Potong retur dibatalkan}
|
|
5
|
+
on: payment.cancelled
|
|
6
|
+
if: event.method == 'sales_return' && event.sales_return != ''
|
|
7
|
+
steps:
|
|
8
|
+
- {find: return_credit, where: sales_return == event.sales_return, as: rc}
|
|
9
|
+
- update: rc
|
|
10
|
+
if: rc != null
|
|
11
|
+
set: {credited: rc.credited - event.amount}
|