shutro-erp 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account_asset/.kosh/bindings.d.ts +22 -0
- package/dist/account_asset/.kosh/bindings.js +15 -0
- package/dist/account_asset/.kosh/schema.d.ts +1755 -0
- package/dist/account_asset/board.d.ts +61 -0
- package/dist/account_asset/board.js +86 -0
- package/dist/account_asset/books.d.ts +42 -0
- package/dist/account_asset/books.js +398 -0
- package/dist/account_asset/demo.d.ts +7 -0
- package/dist/account_asset/demo.js +72 -0
- package/dist/account_asset/index.d.ts +9 -0
- package/dist/account_asset/index.js +335 -0
- package/dist/account_asset/module.d.ts +7622 -0
- package/dist/account_asset/module.js +230 -0
- package/dist/account_budget/.kosh/bindings.d.ts +22 -0
- package/dist/account_budget/.kosh/bindings.js +15 -0
- package/dist/account_budget/.kosh/schema.d.ts +1767 -0
- package/dist/account_budget/budget.d.ts +5 -0
- package/dist/account_budget/budget.js +142 -0
- package/dist/account_budget/demo.d.ts +6 -0
- package/dist/account_budget/demo.js +30 -0
- package/dist/account_budget/index.d.ts +4 -0
- package/dist/account_budget/index.js +223 -0
- package/dist/account_budget/module.d.ts +13863 -0
- package/dist/account_budget/module.js +167 -0
- package/dist/account_portal/.kosh/bindings.js +1 -1
- package/dist/account_portal/.kosh/schema.d.ts +176 -6
- package/dist/account_portal/module.d.ts +505 -6
- package/dist/accounting/.kosh/bindings.js +1 -1
- package/dist/accounting/.kosh/schema.d.ts +176 -6
- package/dist/accounting/index.d.ts +1 -1
- package/dist/accounting/index.js +344 -4
- package/dist/accounting/module.d.ts +513 -5
- package/dist/accounting/module.js +55 -3
- package/dist/approvals/.kosh/bindings.d.ts +22 -0
- package/dist/approvals/.kosh/bindings.js +15 -0
- package/dist/approvals/.kosh/schema.d.ts +611 -0
- package/dist/approvals/index.d.ts +18 -0
- package/dist/approvals/index.js +302 -0
- package/dist/approvals/mails.d.ts +25 -0
- package/dist/approvals/mails.js +82 -0
- package/dist/approvals/module.d.ts +1 -0
- package/dist/approvals/module.js +12 -0
- package/dist/approvals/web/History.d.ts +4 -0
- package/dist/approvals/web/History.js +13 -0
- package/dist/approvals/web/Inbox.d.ts +9 -0
- package/dist/approvals/web/Inbox.js +114 -0
- package/dist/approvals/web/Mine.d.ts +7 -0
- package/dist/approvals/web/Mine.js +27 -0
- package/dist/approvals/web/index.d.ts +13 -0
- package/dist/approvals/web/index.js +22 -0
- package/dist/approvals/web/messages.d.ts +2 -0
- package/dist/approvals/web/messages.js +119 -0
- package/dist/approvals/web/shared.d.ts +59 -0
- package/dist/approvals/web/shared.js +46 -0
- package/dist/attendance/.kosh/bindings.d.ts +22 -0
- package/dist/attendance/.kosh/bindings.js +15 -0
- package/dist/attendance/.kosh/schema.d.ts +1048 -0
- package/dist/attendance/days.d.ts +96 -0
- package/dist/attendance/days.js +430 -0
- package/dist/attendance/demo.d.ts +7 -0
- package/dist/attendance/demo.js +58 -0
- package/dist/attendance/index.d.ts +4 -0
- package/dist/attendance/index.js +513 -0
- package/dist/attendance/module.d.ts +3969 -0
- package/dist/attendance/module.js +412 -0
- package/dist/attendance/routes.d.ts +16 -0
- package/dist/attendance/routes.js +266 -0
- package/dist/attendance/web/Check.d.ts +8 -0
- package/dist/attendance/web/Check.js +40 -0
- package/dist/attendance/web/Kiosk.d.ts +8 -0
- package/dist/attendance/web/Kiosk.js +62 -0
- package/dist/attendance/web/PinButton.d.ts +7 -0
- package/dist/attendance/web/PinButton.js +29 -0
- package/dist/attendance/web/index.d.ts +13 -0
- package/dist/attendance/web/index.js +22 -0
- package/dist/attendance/web/messages.d.ts +2 -0
- package/dist/attendance/web/messages.js +61 -0
- package/dist/calendar/.kosh/bindings.d.ts +22 -0
- package/dist/calendar/.kosh/bindings.js +15 -0
- package/dist/calendar/.kosh/schema.d.ts +795 -0
- package/dist/calendar/demo.d.ts +6 -0
- package/dist/calendar/demo.js +24 -0
- package/dist/calendar/index.d.ts +3 -0
- package/dist/calendar/index.js +291 -0
- package/dist/calendar/module.d.ts +1705 -0
- package/dist/calendar/module.js +180 -0
- package/dist/cli/init.js +80 -0
- package/dist/cli/templates.d.ts +1 -1
- package/dist/cli/templates.js +226 -0
- package/dist/contacts/.kosh/bindings.js +1 -1
- package/dist/contacts/.kosh/schema.d.ts +78 -3
- package/dist/contacts/demo.js +30 -1
- package/dist/contacts/index.d.ts +1 -1
- package/dist/contacts/index.js +155 -9
- package/dist/contacts/module.d.ts +338 -2
- package/dist/contacts/module.js +93 -5
- package/dist/crm/.kosh/bindings.d.ts +22 -0
- package/dist/crm/.kosh/bindings.js +15 -0
- package/dist/crm/.kosh/schema.d.ts +800 -0
- package/dist/crm/demo.d.ts +6 -0
- package/dist/crm/demo.js +45 -0
- package/dist/crm/index.d.ts +3 -0
- package/dist/crm/index.js +361 -0
- package/dist/crm/module.d.ts +1845 -0
- package/dist/crm/module.js +208 -0
- package/dist/documents/.kosh/bindings.d.ts +22 -0
- package/dist/documents/.kosh/bindings.js +15 -0
- package/dist/documents/.kosh/schema.d.ts +862 -0
- package/dist/documents/demo.d.ts +6 -0
- package/dist/documents/demo.js +22 -0
- package/dist/documents/documents.d.ts +98 -0
- package/dist/documents/documents.js +318 -0
- package/dist/documents/index.d.ts +30 -0
- package/dist/documents/index.js +442 -0
- package/dist/documents/module.d.ts +2781 -0
- package/dist/documents/module.js +214 -0
- package/dist/documents/web/Versions.d.ts +7 -0
- package/dist/documents/web/Versions.js +45 -0
- package/dist/documents/web/index.d.ts +11 -0
- package/dist/documents/web/index.js +16 -0
- package/dist/documents/web/messages.d.ts +2 -0
- package/dist/documents/web/messages.js +21 -0
- package/dist/event/.kosh/bindings.d.ts +22 -0
- package/dist/event/.kosh/bindings.js +15 -0
- package/dist/event/.kosh/schema.d.ts +843 -0
- package/dist/event/demo.d.ts +6 -0
- package/dist/event/demo.js +65 -0
- package/dist/event/index.d.ts +14 -0
- package/dist/event/index.js +333 -0
- package/dist/event/mails.d.ts +15 -0
- package/dist/event/mails.js +112 -0
- package/dist/event/module.d.ts +2800 -0
- package/dist/event/module.js +323 -0
- package/dist/event/web/CheckInBox.d.ts +9 -0
- package/dist/event/web/CheckInBox.js +87 -0
- package/dist/event/web/index.d.ts +11 -0
- package/dist/event/web/index.js +16 -0
- package/dist/event/web/messages.d.ts +2 -0
- package/dist/event/web/messages.js +23 -0
- package/dist/event_account/.kosh/bindings.d.ts +22 -0
- package/dist/event_account/.kosh/bindings.js +15 -0
- package/dist/event_account/.kosh/schema.d.ts +1758 -0
- package/dist/event_account/index.d.ts +3 -0
- package/dist/event_account/index.js +28 -0
- package/dist/event_account/module.d.ts +7114 -0
- package/dist/event_account/module.js +90 -0
- package/dist/expense/.kosh/bindings.d.ts +22 -0
- package/dist/expense/.kosh/bindings.js +15 -0
- package/dist/expense/.kosh/schema.d.ts +1299 -0
- package/dist/expense/demo.d.ts +7 -0
- package/dist/expense/demo.js +69 -0
- package/dist/expense/index.d.ts +3 -0
- package/dist/expense/index.js +495 -0
- package/dist/expense/module.d.ts +4747 -0
- package/dist/expense/module.js +647 -0
- package/dist/expense_account/.kosh/bindings.d.ts +22 -0
- package/dist/expense_account/.kosh/bindings.js +15 -0
- package/dist/expense_account/.kosh/schema.d.ts +1936 -0
- package/dist/expense_account/index.d.ts +3 -0
- package/dist/expense_account/index.js +74 -0
- package/dist/expense_account/module.d.ts +9153 -0
- package/dist/expense_account/module.js +318 -0
- package/dist/helpdesk/.kosh/bindings.d.ts +22 -0
- package/dist/helpdesk/.kosh/bindings.js +15 -0
- package/dist/helpdesk/.kosh/schema.d.ts +885 -0
- package/dist/helpdesk/demo.d.ts +7 -0
- package/dist/helpdesk/demo.js +65 -0
- package/dist/helpdesk/hours.d.ts +17 -0
- package/dist/helpdesk/hours.js +94 -0
- package/dist/helpdesk/index.d.ts +10 -0
- package/dist/helpdesk/index.js +461 -0
- package/dist/helpdesk/module.d.ts +2940 -0
- package/dist/helpdesk/module.js +326 -0
- package/dist/helpdesk/routes.d.ts +12 -0
- package/dist/helpdesk/routes.js +132 -0
- package/dist/helpdesk/sla.d.ts +37 -0
- package/dist/helpdesk/sla.js +226 -0
- package/dist/hr/.kosh/bindings.d.ts +22 -0
- package/dist/hr/.kosh/bindings.js +15 -0
- package/dist/hr/.kosh/schema.d.ts +878 -0
- package/dist/hr/demo.d.ts +6 -0
- package/dist/hr/demo.js +60 -0
- package/dist/hr/index.d.ts +3 -0
- package/dist/hr/index.js +483 -0
- package/dist/hr/module.d.ts +2611 -0
- package/dist/hr/module.js +350 -0
- package/dist/l10n_bd/.kosh/bindings.js +1 -1
- package/dist/l10n_bd/.kosh/schema.d.ts +176 -6
- package/dist/l10n_bd/module.d.ts +505 -6
- package/dist/l10n_bd_payroll/.kosh/bindings.d.ts +22 -0
- package/dist/l10n_bd_payroll/.kosh/bindings.js +15 -0
- package/dist/l10n_bd_payroll/.kosh/schema.d.ts +2312 -0
- package/dist/l10n_bd_payroll/data.d.ts +47 -0
- package/dist/l10n_bd_payroll/data.js +347 -0
- package/dist/l10n_bd_payroll/index.d.ts +4 -0
- package/dist/l10n_bd_payroll/index.js +24 -0
- package/dist/l10n_bd_payroll/module.d.ts +12932 -0
- package/dist/l10n_bd_payroll/module.js +86 -0
- package/dist/l10n_in/.kosh/bindings.js +1 -1
- package/dist/l10n_in/.kosh/schema.d.ts +176 -6
- package/dist/l10n_in/module.d.ts +527 -7
- package/dist/mail/inbound/handle.js +6 -1
- package/dist/maintenance/.kosh/bindings.d.ts +22 -0
- package/dist/maintenance/.kosh/bindings.js +15 -0
- package/dist/maintenance/.kosh/schema.d.ts +911 -0
- package/dist/maintenance/demo.d.ts +6 -0
- package/dist/maintenance/demo.js +60 -0
- package/dist/maintenance/index.d.ts +3 -0
- package/dist/maintenance/index.js +422 -0
- package/dist/maintenance/module.d.ts +3545 -0
- package/dist/maintenance/module.js +446 -0
- package/dist/maintenance_stock/.kosh/bindings.d.ts +22 -0
- package/dist/maintenance_stock/.kosh/bindings.js +15 -0
- package/dist/maintenance_stock/.kosh/schema.d.ts +1446 -0
- package/dist/maintenance_stock/index.d.ts +9 -0
- package/dist/maintenance_stock/index.js +52 -0
- package/dist/maintenance_stock/module.d.ts +7675 -0
- package/dist/maintenance_stock/module.js +192 -0
- package/dist/modules-sdk/index.d.ts +1 -1
- package/dist/modules-sdk/manifest.d.ts +109 -2
- package/dist/modules-sdk/manifest.js +35 -1
- package/dist/mrp/.kosh/bindings.d.ts +22 -0
- package/dist/mrp/.kosh/bindings.js +15 -0
- package/dist/mrp/.kosh/schema.d.ts +1453 -0
- package/dist/mrp/demo.d.ts +7 -0
- package/dist/mrp/demo.js +42 -0
- package/dist/mrp/index.d.ts +3 -0
- package/dist/mrp/index.js +393 -0
- package/dist/mrp/module.d.ts +9335 -0
- package/dist/mrp/module.js +757 -0
- package/dist/mrp_account/.kosh/bindings.d.ts +22 -0
- package/dist/mrp_account/.kosh/bindings.js +15 -0
- package/dist/mrp_account/.kosh/schema.d.ts +2299 -0
- package/dist/mrp_account/index.d.ts +3 -0
- package/dist/mrp_account/index.js +22 -0
- package/dist/mrp_account/module.d.ts +23151 -0
- package/dist/mrp_account/module.js +123 -0
- package/dist/payment/.kosh/bindings.js +1 -1
- package/dist/payment/.kosh/schema.d.ts +178 -7
- package/dist/payment/index.d.ts +41 -0
- package/dist/payment/index.js +131 -74
- package/dist/payment/module.d.ts +569 -12
- package/dist/payment/module.js +19 -3
- package/dist/payment/settle.js +10 -1
- package/dist/payroll/.kosh/bindings.d.ts +22 -0
- package/dist/payroll/.kosh/bindings.js +15 -0
- package/dist/payroll/.kosh/schema.d.ts +1390 -0
- package/dist/payroll/compute.d.ts +35 -0
- package/dist/payroll/compute.js +398 -0
- package/dist/payroll/demo.d.ts +55 -0
- package/dist/payroll/demo.js +121 -0
- package/dist/payroll/formula.d.ts +62 -0
- package/dist/payroll/formula.js +320 -0
- package/dist/payroll/index.d.ts +230 -0
- package/dist/payroll/index.js +713 -0
- package/dist/payroll/module.d.ts +9390 -0
- package/dist/payroll/module.js +606 -0
- package/dist/payroll/routes.d.ts +10 -0
- package/dist/payroll/routes.js +112 -0
- package/dist/payroll_account/.kosh/bindings.d.ts +22 -0
- package/dist/payroll_account/.kosh/bindings.js +15 -0
- package/dist/payroll_account/.kosh/schema.d.ts +2308 -0
- package/dist/payroll_account/index.d.ts +3 -0
- package/dist/payroll_account/index.js +40 -0
- package/dist/payroll_account/module.d.ts +12396 -0
- package/dist/payroll_account/module.js +256 -0
- package/dist/permissions/approvals.d.ts +131 -9
- package/dist/permissions/approvals.js +662 -57
- package/dist/permissions/index.d.ts +1 -1
- package/dist/permissions/index.js +2 -2
- package/dist/permissions/models.js +191 -12
- package/dist/permissions/routes.d.ts +6 -1
- package/dist/permissions/routes.js +37 -4
- package/dist/permissions/web/ApprovalPanel.d.ts +5 -4
- package/dist/permissions/web/ApprovalPanel.js +39 -13
- package/dist/permissions/web/index.d.ts +6 -4
- package/dist/permissions/web/index.js +13 -4
- package/dist/permissions/web/messages.d.ts +2 -0
- package/dist/permissions/web/messages.js +43 -0
- package/dist/portal/.kosh/bindings.js +1 -1
- package/dist/portal/.kosh/schema.d.ts +78 -3
- package/dist/portal/index.js +1 -1
- package/dist/portal/module.d.ts +166 -2
- package/dist/pos/.kosh/bindings.d.ts +22 -0
- package/dist/pos/.kosh/bindings.js +15 -0
- package/dist/pos/.kosh/schema.d.ts +1809 -0
- package/dist/pos/accounting.d.ts +10 -0
- package/dist/pos/accounting.js +149 -0
- package/dist/pos/demo.d.ts +6 -0
- package/dist/pos/demo.js +90 -0
- package/dist/pos/index.d.ts +9 -0
- package/dist/pos/index.js +353 -0
- package/dist/pos/module.d.ts +9783 -0
- package/dist/pos/module.js +423 -0
- package/dist/pos/routes.d.ts +39 -0
- package/dist/pos/routes.js +368 -0
- package/dist/pos/web/Register.d.ts +9 -0
- package/dist/pos/web/Register.js +252 -0
- package/dist/pos/web/index.d.ts +11 -0
- package/dist/pos/web/index.js +16 -0
- package/dist/pos/web/messages.d.ts +2 -0
- package/dist/pos/web/messages.js +87 -0
- package/dist/pos_stock/.kosh/bindings.d.ts +22 -0
- package/dist/pos_stock/.kosh/bindings.js +15 -0
- package/dist/pos_stock/.kosh/schema.d.ts +2208 -0
- package/dist/pos_stock/index.d.ts +9 -0
- package/dist/pos_stock/index.js +35 -0
- package/dist/pos_stock/module.d.ts +12803 -0
- package/dist/pos_stock/module.js +115 -0
- package/dist/product/.kosh/bindings.js +1 -1
- package/dist/product/.kosh/schema.d.ts +52 -1
- package/dist/product/index.js +94 -4
- package/dist/product/module.d.ts +45 -1
- package/dist/product/module.js +11 -3
- package/dist/project/.kosh/bindings.js +1 -1
- package/dist/project/.kosh/schema.d.ts +725 -3
- package/dist/project/index.d.ts +3 -1
- package/dist/project/index.js +1045 -18
- package/dist/project/module.d.ts +10168 -458
- package/dist/project/module.js +1578 -14
- package/dist/project/routes.d.ts +44 -0
- package/dist/project/routes.js +314 -0
- package/dist/project/schedule.d.ts +72 -0
- package/dist/project/schedule.js +192 -0
- package/dist/project/web/Refresh.d.ts +8 -0
- package/dist/project/web/Refresh.js +29 -0
- package/dist/project/web/Schedule.d.ts +9 -0
- package/dist/project/web/Schedule.js +93 -0
- package/dist/project/web/Structure.d.ts +8 -0
- package/dist/project/web/Structure.js +86 -0
- package/dist/project/web/Workload.d.ts +8 -0
- package/dist/project/web/Workload.js +43 -0
- package/dist/project/web/index.d.ts +14 -0
- package/dist/project/web/index.js +25 -0
- package/dist/project/web/messages.d.ts +2 -0
- package/dist/project/web/messages.js +85 -0
- package/dist/project_account/.kosh/bindings.d.ts +22 -0
- package/dist/project_account/.kosh/bindings.js +15 -0
- package/dist/project_account/.kosh/schema.d.ts +2241 -0
- package/dist/project_account/index.d.ts +3 -0
- package/dist/project_account/index.js +27 -0
- package/dist/project_account/module.d.ts +11539 -0
- package/dist/project_account/module.js +76 -0
- package/dist/project_portal/.kosh/bindings.js +1 -1
- package/dist/project_portal/.kosh/schema.d.ts +725 -3
- package/dist/project_portal/module.d.ts +5137 -119
- package/dist/project_purchase/.kosh/bindings.d.ts +22 -0
- package/dist/project_purchase/.kosh/bindings.js +15 -0
- package/dist/project_purchase/.kosh/schema.d.ts +2320 -0
- package/dist/project_purchase/index.d.ts +9 -0
- package/dist/project_purchase/index.js +22 -0
- package/dist/project_purchase/module.d.ts +25147 -0
- package/dist/project_purchase/module.js +56 -0
- package/dist/purchase/.kosh/bindings.js +1 -1
- package/dist/purchase/.kosh/schema.d.ts +150 -6
- package/dist/purchase/index.js +163 -3
- package/dist/purchase/module.d.ts +228 -5
- package/dist/purchase/module.js +30 -3
- package/dist/purchase_account/.kosh/bindings.js +1 -1
- package/dist/purchase_account/.kosh/schema.d.ts +180 -8
- package/dist/purchase_account/index.js +27 -1
- package/dist/purchase_account/module.d.ts +591 -30
- package/dist/purchase_account/module.js +13 -2
- package/dist/purchase_portal/.kosh/bindings.js +1 -1
- package/dist/purchase_portal/.kosh/schema.d.ts +150 -6
- package/dist/purchase_portal/module.d.ts +372 -6
- package/dist/purchase_stock/.kosh/bindings.d.ts +22 -0
- package/dist/purchase_stock/.kosh/bindings.js +15 -0
- package/dist/purchase_stock/.kosh/schema.d.ts +1479 -0
- package/dist/purchase_stock/index.d.ts +7 -0
- package/dist/purchase_stock/index.js +98 -0
- package/dist/purchase_stock/module.d.ts +7535 -0
- package/dist/purchase_stock/module.js +380 -0
- package/dist/purchase_stock_account/.kosh/bindings.d.ts +22 -0
- package/dist/purchase_stock_account/.kosh/bindings.js +15 -0
- package/dist/purchase_stock_account/.kosh/schema.d.ts +2155 -0
- package/dist/purchase_stock_account/index.d.ts +3 -0
- package/dist/purchase_stock_account/index.js +24 -0
- package/dist/purchase_stock_account/module.d.ts +38015 -0
- package/dist/purchase_stock_account/module.js +168 -0
- package/dist/recruitment/.kosh/bindings.d.ts +22 -0
- package/dist/recruitment/.kosh/bindings.js +15 -0
- package/dist/recruitment/.kosh/schema.d.ts +991 -0
- package/dist/recruitment/demo.d.ts +6 -0
- package/dist/recruitment/demo.js +45 -0
- package/dist/recruitment/index.d.ts +3 -0
- package/dist/recruitment/index.js +385 -0
- package/dist/recruitment/module.d.ts +3249 -0
- package/dist/recruitment/module.js +194 -0
- package/dist/recruitment/web/HireButton.d.ts +9 -0
- package/dist/recruitment/web/HireButton.js +32 -0
- package/dist/recruitment/web/index.d.ts +11 -0
- package/dist/recruitment/web/index.js +16 -0
- package/dist/recruitment/web/messages.d.ts +2 -0
- package/dist/recruitment/web/messages.js +19 -0
- package/dist/reporting/documents.d.ts +5 -0
- package/dist/reporting/documents.js +28 -1
- package/dist/reporting/index.d.ts +1 -1
- package/dist/reporting/index.js +4 -2
- package/dist/reporting/models.js +9 -0
- package/dist/reporting/overviews.d.ts +16 -0
- package/dist/reporting/overviews.js +56 -0
- package/dist/reporting/routes-documents.js +1 -1
- package/dist/reporting/routes.js +138 -80
- package/dist/reporting/web/DashboardView.d.ts +11 -0
- package/dist/reporting/web/DashboardView.js +2 -2
- package/dist/reporting/web/DesignerView.js +5 -0
- package/dist/reporting/web/Overview.d.ts +9 -0
- package/dist/reporting/web/Overview.js +53 -0
- package/dist/reporting/web/index.d.ts +1 -0
- package/dist/reporting/web/index.js +4 -1
- package/dist/reporting/web/messages.js +9 -0
- package/dist/sale_account/.kosh/bindings.js +1 -1
- package/dist/sale_account/.kosh/schema.d.ts +181 -6
- package/dist/sale_account/index.js +22 -1
- package/dist/sale_account/module.d.ts +639 -38
- package/dist/sale_portal/.kosh/bindings.js +1 -1
- package/dist/sale_portal/.kosh/schema.d.ts +59 -3
- package/dist/sale_portal/module.d.ts +435 -5
- package/dist/sale_project/.kosh/bindings.js +1 -1
- package/dist/sale_project/.kosh/schema.d.ts +732 -3
- package/dist/sale_project/module.d.ts +5349 -208
- package/dist/sale_project/module.js +17 -1
- package/dist/sale_stock/.kosh/bindings.d.ts +22 -0
- package/dist/sale_stock/.kosh/bindings.js +15 -0
- package/dist/sale_stock/.kosh/schema.d.ts +1303 -0
- package/dist/sale_stock/index.d.ts +7 -0
- package/dist/sale_stock/index.js +84 -0
- package/dist/sale_stock/module.d.ts +7514 -0
- package/dist/sale_stock/module.js +146 -0
- package/dist/sales/.kosh/bindings.js +1 -1
- package/dist/sales/.kosh/schema.d.ts +59 -3
- package/dist/sales/index.js +195 -4
- package/dist/sales/module.d.ts +356 -3
- package/dist/sales/module.js +78 -3
- package/dist/server/api/metadata.d.ts +5 -0
- package/dist/server/api/metadata.js +5 -0
- package/dist/server/api/rest.js +64 -1
- package/dist/server/api/views.js +1 -0
- package/dist/server/app-settings.d.ts +7 -0
- package/dist/server/app-settings.js +10 -0
- package/dist/server/auth/base.js +9 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/settings/app-settings.d.ts +2 -0
- package/dist/settings/app-settings.js +518 -0
- package/dist/settings/index.d.ts +1 -0
- package/dist/settings/index.js +15 -0
- package/dist/settings/people.js +29 -5
- package/dist/settings/web/AppSettingsPage.d.ts +11 -0
- package/dist/settings/web/AppSettingsPage.js +210 -0
- package/dist/settings/web/OverviewPage.js +16 -3
- package/dist/settings/web/PeoplePage.js +20 -6
- package/dist/settings/web/index.d.ts +1 -0
- package/dist/settings/web/index.js +3 -0
- package/dist/settings/web/messages.js +118 -2
- package/dist/sign/.kosh/bindings.d.ts +22 -0
- package/dist/sign/.kosh/bindings.js +15 -0
- package/dist/sign/.kosh/schema.d.ts +990 -0
- package/dist/sign/index.d.ts +14 -0
- package/dist/sign/index.js +350 -0
- package/dist/sign/module.d.ts +4478 -0
- package/dist/sign/module.js +158 -0
- package/dist/sign/sign.d.ts +82 -0
- package/dist/sign/sign.js +474 -0
- package/dist/stock/.kosh/bindings.d.ts +22 -0
- package/dist/stock/.kosh/bindings.js +15 -0
- package/dist/stock/.kosh/schema.d.ts +1222 -0
- package/dist/stock/demo.d.ts +8 -0
- package/dist/stock/demo.js +82 -0
- package/dist/stock/index.d.ts +4 -0
- package/dist/stock/index.js +903 -0
- package/dist/stock/module.d.ts +7856 -0
- package/dist/stock/module.js +1880 -0
- package/dist/stock/replenish.d.ts +38 -0
- package/dist/stock/replenish.js +176 -0
- package/dist/stock/web/Replenishment.d.ts +8 -0
- package/dist/stock/web/Replenishment.js +84 -0
- package/dist/stock/web/ScanBox.d.ts +8 -0
- package/dist/stock/web/ScanBox.js +90 -0
- package/dist/stock/web/index.d.ts +13 -0
- package/dist/stock/web/index.js +20 -0
- package/dist/stock/web/messages.d.ts +2 -0
- package/dist/stock/web/messages.js +77 -0
- package/dist/stock_account/.kosh/bindings.d.ts +22 -0
- package/dist/stock_account/.kosh/bindings.js +15 -0
- package/dist/stock_account/.kosh/schema.d.ts +2068 -0
- package/dist/stock_account/index.d.ts +3 -0
- package/dist/stock_account/index.js +140 -0
- package/dist/stock_account/module.d.ts +11523 -0
- package/dist/stock_account/module.js +339 -0
- package/dist/storage/attachments.d.ts +5 -0
- package/dist/storage/attachments.js +12 -1
- package/dist/storage/models.js +3 -0
- package/dist/storage/routes.js +13 -2
- package/dist/todo/.kosh/bindings.d.ts +22 -0
- package/dist/todo/.kosh/bindings.js +15 -0
- package/dist/todo/.kosh/schema.d.ts +732 -0
- package/dist/todo/demo.d.ts +6 -0
- package/dist/todo/demo.js +35 -0
- package/dist/todo/index.d.ts +3 -0
- package/dist/todo/index.js +187 -0
- package/dist/todo/module.d.ts +1180 -0
- package/dist/todo/module.js +130 -0
- package/dist/trade_finance/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance/.kosh/bindings.js +15 -0
- package/dist/trade_finance/.kosh/schema.d.ts +884 -0
- package/dist/trade_finance/demo.d.ts +6 -0
- package/dist/trade_finance/demo.js +63 -0
- package/dist/trade_finance/index.d.ts +3 -0
- package/dist/trade_finance/index.js +415 -0
- package/dist/trade_finance/module.d.ts +3779 -0
- package/dist/trade_finance/module.js +507 -0
- package/dist/trade_finance_account/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance_account/.kosh/bindings.js +15 -0
- package/dist/trade_finance_account/.kosh/schema.d.ts +1830 -0
- package/dist/trade_finance_account/index.d.ts +3 -0
- package/dist/trade_finance_account/index.js +93 -0
- package/dist/trade_finance_account/module.d.ts +8074 -0
- package/dist/trade_finance_account/module.js +245 -0
- package/dist/trade_finance_purchase/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance_purchase/.kosh/bindings.js +15 -0
- package/dist/trade_finance_purchase/.kosh/schema.d.ts +1246 -0
- package/dist/trade_finance_purchase/index.d.ts +8 -0
- package/dist/trade_finance_purchase/index.js +50 -0
- package/dist/trade_finance_purchase/module.d.ts +4257 -0
- package/dist/trade_finance_purchase/module.js +44 -0
- package/dist/trade_finance_sale/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance_sale/.kosh/bindings.js +15 -0
- package/dist/trade_finance_sale/.kosh/schema.d.ts +1072 -0
- package/dist/trade_finance_sale/index.d.ts +8 -0
- package/dist/trade_finance_sale/index.js +50 -0
- package/dist/trade_finance_sale/module.d.ts +4281 -0
- package/dist/trade_finance_sale/module.js +44 -0
- package/dist/ui/api.d.ts +2 -1
- package/dist/ui/api.js +2 -1
- package/dist/ui/app.js +26 -13
- package/dist/ui/components/AppIcon.js +30 -1
- package/dist/ui/components/primitives.d.ts +2 -0
- package/dist/ui/components/primitives.js +7 -1
- package/dist/ui/i18n/messages.d.ts +27 -0
- package/dist/ui/i18n/messages.js +46 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/offline/queue.d.ts +5 -1
- package/dist/ui/offline/queue.js +2 -0
- package/dist/ui/registry.d.ts +5 -0
- package/dist/ui/shell/Home.js +55 -4
- package/dist/ui/views/FormView.js +102 -19
- package/dist/ui/views/KanbanView.d.ts +2 -0
- package/dist/ui/views/KanbanView.js +40 -3
- package/dist/ui/views/ListView.js +110 -11
- package/dist/ui/views/StatsRow.d.ts +14 -0
- package/dist/ui/views/StatsRow.js +88 -0
- package/dist/ui/views/widgets.d.ts +2 -1
- package/dist/ui/views/widgets.js +200 -1
- package/dist/views/builders.d.ts +19 -2
- package/dist/views/builders.js +21 -1
- package/dist/views/condition.d.ts +6 -0
- package/dist/views/condition.js +20 -0
- package/dist/views/documents.d.ts +8 -0
- package/dist/views/extend.d.ts +2 -2
- package/dist/views/extend.js +11 -1
- package/dist/views/index.d.ts +2 -2
- package/dist/views/index.js +2 -2
- package/dist/views/types.d.ts +52 -5
- package/dist/views/validate.js +39 -1
- package/dist/website/.kosh/bindings.d.ts +22 -0
- package/dist/website/.kosh/bindings.js +15 -0
- package/dist/website/.kosh/schema.d.ts +881 -0
- package/dist/website/demo.d.ts +6 -0
- package/dist/website/demo.js +115 -0
- package/dist/website/index.d.ts +9 -0
- package/dist/website/index.js +251 -0
- package/dist/website/module.d.ts +2987 -0
- package/dist/website/module.js +282 -0
- package/dist/website/render.d.ts +45 -0
- package/dist/website/render.js +102 -0
- package/dist/website/routes.d.ts +12 -0
- package/dist/website/routes.js +246 -0
- package/dist/website/web/PagePreview.d.ts +7 -0
- package/dist/website/web/PagePreview.js +33 -0
- package/dist/website/web/index.d.ts +11 -0
- package/dist/website/web/index.js +16 -0
- package/dist/website/web/messages.d.ts +2 -0
- package/dist/website/web/messages.js +15 -0
- package/dist/website_crm/.kosh/bindings.d.ts +22 -0
- package/dist/website_crm/.kosh/bindings.js +15 -0
- package/dist/website_crm/.kosh/schema.d.ts +967 -0
- package/dist/website_crm/index.d.ts +3 -0
- package/dist/website_crm/index.js +39 -0
- package/dist/website_crm/module.d.ts +2956 -0
- package/dist/website_crm/module.js +44 -0
- package/dist/website_sale/.kosh/bindings.d.ts +22 -0
- package/dist/website_sale/.kosh/bindings.js +15 -0
- package/dist/website_sale/.kosh/schema.d.ts +2284 -0
- package/dist/website_sale/couriers.d.ts +50 -0
- package/dist/website_sale/couriers.js +59 -0
- package/dist/website_sale/demo.d.ts +7 -0
- package/dist/website_sale/demo.js +90 -0
- package/dist/website_sale/growth.d.ts +31 -0
- package/dist/website_sale/growth.js +163 -0
- package/dist/website_sale/index.d.ts +49 -0
- package/dist/website_sale/index.js +538 -0
- package/dist/website_sale/module.d.ts +22027 -0
- package/dist/website_sale/module.js +397 -0
- package/dist/website_sale/shipments.d.ts +16 -0
- package/dist/website_sale/shipments.js +113 -0
- package/dist/website_sale/shop.d.ts +81 -0
- package/dist/website_sale/shop.js +649 -0
- package/dist/website_sale_stock/.kosh/bindings.d.ts +22 -0
- package/dist/website_sale_stock/.kosh/bindings.js +15 -0
- package/dist/website_sale_stock/.kosh/schema.d.ts +2681 -0
- package/dist/website_sale_stock/index.d.ts +9 -0
- package/dist/website_sale_stock/index.js +20 -0
- package/dist/website_sale_stock/module.d.ts +24998 -0
- package/dist/website_sale_stock/module.js +28 -0
- package/package.json +200 -2
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The data layer of Asset Care (RFC 0021): equipment with its meters and warranty, preventive plans by time or by
|
|
3
|
+
* meter with their checklists, and maintenance orders — preventive or breakdown — whose checklist is ticked before
|
|
4
|
+
* they are done, with labour hours and the downtime from report to finish.
|
|
5
|
+
*/
|
|
6
|
+
import { contactsShutro } from '../contacts/index.js';
|
|
7
|
+
import { messagingShutro } from '../messaging/index.js';
|
|
8
|
+
import { installationSetting } from '../server/index.js';
|
|
9
|
+
import { orm } from '../server/orm.js';
|
|
10
|
+
import { check, compute, defineModel, defineModule, f, method, records, } from './.kosh/bindings.js';
|
|
11
|
+
const READ = ['read'];
|
|
12
|
+
const ALL = ['read', 'write', 'create', 'unlink'];
|
|
13
|
+
const zero = orm.toDecimal(0);
|
|
14
|
+
const OPEN = ['new', 'progress'];
|
|
15
|
+
/** A date as `YYYY-MM-DD` (date-only values from PostgreSQL are local midnights: their local parts). */
|
|
16
|
+
export const iso = (v) => {
|
|
17
|
+
if (!(v instanceof Date))
|
|
18
|
+
return String(v ?? '').slice(0, 10);
|
|
19
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
20
|
+
return `${v.getFullYear()}-${pad(v.getMonth() + 1)}-${pad(v.getDate())}`;
|
|
21
|
+
};
|
|
22
|
+
const addDays = (date, days) => {
|
|
23
|
+
const d = new Date(`${date}T00:00:00`);
|
|
24
|
+
d.setDate(d.getDate() + days);
|
|
25
|
+
return iso(d);
|
|
26
|
+
};
|
|
27
|
+
/** Hours between two instants, from whole milliseconds (no fractional JS numbers into decimals). */
|
|
28
|
+
export const hoursBetween = (from, to) => orm.toDecimal(Math.max(0, to.getTime() - from.getTime())).div(3_600_000);
|
|
29
|
+
/** The cost of an hour of a technician's work (App settings › Asset Care). */
|
|
30
|
+
export async function labourRate(env) {
|
|
31
|
+
try {
|
|
32
|
+
const rate = orm.toDecimal(String(await installationSetting(env, 'maintenance.labourRate', '0')));
|
|
33
|
+
return rate.gte(0) ? rate : zero;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return zero;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** How many days before a plan is due its order is made (App settings › Asset Care). */
|
|
40
|
+
export async function leadDays(env) {
|
|
41
|
+
const value = Number(await installationSetting(env, 'maintenance.leadDays', 7));
|
|
42
|
+
return Number.isInteger(value) && value >= 0 ? value : 7;
|
|
43
|
+
}
|
|
44
|
+
export const MaintenanceEquipment = defineModel('maintenance.equipment', {
|
|
45
|
+
label: 'Equipment',
|
|
46
|
+
recName: 'name',
|
|
47
|
+
order: ['name asc'],
|
|
48
|
+
archivable: true,
|
|
49
|
+
companyScoped: { required: true },
|
|
50
|
+
tracking: ['location', 'responsible', 'warrantyUntil'],
|
|
51
|
+
access: {
|
|
52
|
+
'maintenance.user': READ,
|
|
53
|
+
'maintenance.manager': [...ALL, 'export', 'import'],
|
|
54
|
+
},
|
|
55
|
+
fields: {
|
|
56
|
+
name: f.char({ required: true }),
|
|
57
|
+
/** The asset tag or serial number. */
|
|
58
|
+
code: f.char({ label: 'Asset tag' }),
|
|
59
|
+
category: f.selection({
|
|
60
|
+
machine: 'Machine',
|
|
61
|
+
vehicle: 'Vehicle',
|
|
62
|
+
it: 'IT equipment',
|
|
63
|
+
building: 'Building and facilities',
|
|
64
|
+
tool: 'Tool',
|
|
65
|
+
other: 'Other',
|
|
66
|
+
}, { required: true, default: 'machine' }),
|
|
67
|
+
location: f.char({ label: 'Where it is' }),
|
|
68
|
+
vendor: f.many2one('res.partner', { ondelete: 'set null' }),
|
|
69
|
+
purchaseDate: f.date({ label: 'Bought on' }),
|
|
70
|
+
warrantyUntil: f.date({ label: 'Warranty until' }),
|
|
71
|
+
responsible: f.many2one('res.users', { ondelete: 'set null' }),
|
|
72
|
+
meters: f.one2many('maintenance.meter', 'equipment'),
|
|
73
|
+
plans: f.one2many('maintenance.plan', 'equipment'),
|
|
74
|
+
requests: f.one2many('maintenance.request', 'equipment', { label: 'Maintenance orders' }),
|
|
75
|
+
/** Operational, Down while a breakdown is open, Retired when archived. */
|
|
76
|
+
status: f.selection({ operational: 'Operational', down: 'Down', retired: 'Retired' }, {
|
|
77
|
+
store: true,
|
|
78
|
+
label: 'Status',
|
|
79
|
+
...compute('maintenance.equipment', 'status', ['active', 'requests.state', 'requests.kind'], (equipment) => {
|
|
80
|
+
for (const e of equipment)
|
|
81
|
+
e.status = !e.active
|
|
82
|
+
? 'retired'
|
|
83
|
+
: [...e.requests].some((r) => r.kind === 'breakdown' && (r.state === 'new' || r.state === 'progress'))
|
|
84
|
+
? 'down'
|
|
85
|
+
: 'operational';
|
|
86
|
+
}),
|
|
87
|
+
}),
|
|
88
|
+
note: f.text(),
|
|
89
|
+
},
|
|
90
|
+
sqlConstraints: {
|
|
91
|
+
oneTag: {
|
|
92
|
+
unique: ['company', 'code'],
|
|
93
|
+
message: 'Another piece of equipment has this asset tag.',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
export const MaintenanceMeter = defineModel('maintenance.meter', {
|
|
98
|
+
label: 'Meter',
|
|
99
|
+
recName: 'name',
|
|
100
|
+
order: ['id asc'],
|
|
101
|
+
access: { 'maintenance.user': READ, 'maintenance.manager': ALL },
|
|
102
|
+
fields: {
|
|
103
|
+
equipment: f.many2one('maintenance.equipment', { required: true, ondelete: 'cascade' }),
|
|
104
|
+
name: f.char({ required: true }),
|
|
105
|
+
unit: f.char({ required: true, default: 'h' }),
|
|
106
|
+
readings: f.one2many('maintenance.meter.reading', 'meter'),
|
|
107
|
+
/** The latest reading. */
|
|
108
|
+
value: f.decimal({
|
|
109
|
+
scale: 2,
|
|
110
|
+
store: true,
|
|
111
|
+
label: 'Reading',
|
|
112
|
+
...compute('maintenance.meter', 'value', ['readings.value', 'readings.date'], (meters) => {
|
|
113
|
+
for (const m of meters) {
|
|
114
|
+
const latest = [...m.readings].sort((a, b) => b.date.getTime() - a.date.getTime() || b.id - a.id)[0];
|
|
115
|
+
m.value = latest?.value ?? zero;
|
|
116
|
+
}
|
|
117
|
+
}),
|
|
118
|
+
}),
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
export const MaintenanceMeterReading = defineModel('maintenance.meter.reading', {
|
|
122
|
+
label: 'Meter reading',
|
|
123
|
+
order: ['date desc', 'id desc'],
|
|
124
|
+
access: {
|
|
125
|
+
'maintenance.user': ['read', 'create'],
|
|
126
|
+
'maintenance.manager': ALL,
|
|
127
|
+
},
|
|
128
|
+
fields: {
|
|
129
|
+
meter: f.many2one('maintenance.meter', { required: true, ondelete: 'cascade' }),
|
|
130
|
+
date: f.datetime({ required: true, default: () => new Date(), label: 'Read at' }),
|
|
131
|
+
value: f.decimal({ scale: 2, required: true }),
|
|
132
|
+
},
|
|
133
|
+
constraints: {
|
|
134
|
+
// A meter counts up: a reading is never below an earlier one, nor above a later one.
|
|
135
|
+
neverBackwards: {
|
|
136
|
+
...check('maintenance.meter.reading', ['value', 'date', 'meter'], async (readings) => readings.env.asSuperuser({ reason: 'meter readings' }, async (su) => {
|
|
137
|
+
const failing = [];
|
|
138
|
+
for (const r of readings) {
|
|
139
|
+
const earlierHigher = await su.model('maintenance.meter.reading').search({
|
|
140
|
+
where: {
|
|
141
|
+
meter: r.meter.id,
|
|
142
|
+
date: { lt: r.date },
|
|
143
|
+
value: { gt: r.value },
|
|
144
|
+
id: { ne: r.id },
|
|
145
|
+
},
|
|
146
|
+
limit: 1,
|
|
147
|
+
});
|
|
148
|
+
const laterLower = await su.model('maintenance.meter.reading').search({
|
|
149
|
+
where: {
|
|
150
|
+
meter: r.meter.id,
|
|
151
|
+
date: { gt: r.date },
|
|
152
|
+
value: { lt: r.value },
|
|
153
|
+
id: { ne: r.id },
|
|
154
|
+
},
|
|
155
|
+
limit: 1,
|
|
156
|
+
});
|
|
157
|
+
if (earlierHigher.length > 0 || laterLower.length > 0)
|
|
158
|
+
failing.push(r.id);
|
|
159
|
+
}
|
|
160
|
+
return failing;
|
|
161
|
+
})),
|
|
162
|
+
message: 'A meter counts up: a reading cannot be below an earlier one.',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
export const MaintenancePlan = defineModel('maintenance.plan', {
|
|
167
|
+
label: 'Preventive plan',
|
|
168
|
+
recName: 'name',
|
|
169
|
+
order: ['nextDate asc', 'id asc'],
|
|
170
|
+
archivable: true,
|
|
171
|
+
companyScoped: { required: true },
|
|
172
|
+
tracking: ['lastDoneDate', 'lastDoneValue'],
|
|
173
|
+
access: { 'maintenance.user': READ, 'maintenance.manager': [...ALL, 'export'] },
|
|
174
|
+
fields: {
|
|
175
|
+
name: f.char({ required: true }),
|
|
176
|
+
equipment: f.many2one('maintenance.equipment', { required: true, ondelete: 'cascade' }),
|
|
177
|
+
trigger: f.selection({ time: 'Every so many days', meter: 'Every so much on a meter' }, { required: true, default: 'time', label: 'When' }),
|
|
178
|
+
intervalDays: f.integer({ label: 'Every (days)' }),
|
|
179
|
+
startDate: f.date({ required: true, default: (env) => env.today(), label: 'From' }),
|
|
180
|
+
meter: f.many2one('maintenance.meter', { ondelete: 'restrict' }),
|
|
181
|
+
intervalValue: f.decimal({ scale: 2, label: 'Every (on the meter)' }),
|
|
182
|
+
lastDoneDate: f.date({ label: 'Last done' }),
|
|
183
|
+
lastDoneValue: f.decimal({ scale: 2, label: 'Last done at (meter)' }),
|
|
184
|
+
/** By time: when it is next due. */
|
|
185
|
+
nextDate: f.date({
|
|
186
|
+
store: true,
|
|
187
|
+
label: 'Next due',
|
|
188
|
+
...compute('maintenance.plan', 'nextDate', ['trigger', 'intervalDays', 'startDate', 'lastDoneDate'], (plans) => {
|
|
189
|
+
for (const p of plans)
|
|
190
|
+
p.nextDate =
|
|
191
|
+
p.trigger !== 'time' || p.intervalDays === null
|
|
192
|
+
? null
|
|
193
|
+
: p.lastDoneDate === null
|
|
194
|
+
? p.startDate
|
|
195
|
+
: addDays(iso(p.lastDoneDate), p.intervalDays);
|
|
196
|
+
}),
|
|
197
|
+
}),
|
|
198
|
+
tasks: f.one2many('maintenance.plan.task', 'plan', { label: 'Checklist' }),
|
|
199
|
+
hours: f.decimal({ scale: 2, default: '1', label: 'Planned hours' }),
|
|
200
|
+
},
|
|
201
|
+
constraints: {
|
|
202
|
+
complete: {
|
|
203
|
+
...check('maintenance.plan', ['trigger', 'intervalDays', 'meter', 'intervalValue', 'equipment'], async (plans) => (await plans.load({ meter: true }))
|
|
204
|
+
.filter((p) => p.trigger === 'time'
|
|
205
|
+
? p.intervalDays === null || p.intervalDays <= 0
|
|
206
|
+
: p.meter === null ||
|
|
207
|
+
p.intervalValue === null ||
|
|
208
|
+
p.intervalValue.lte(0) ||
|
|
209
|
+
p.meter.equipment.id !== p.equipment.id)
|
|
210
|
+
.map((p) => p.id)),
|
|
211
|
+
message: 'A plan by time repeats every so many days; by meter, every so much on one of the equipment’s meters.',
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
export const MaintenancePlanTask = defineModel('maintenance.plan.task', {
|
|
216
|
+
label: 'Checklist item',
|
|
217
|
+
order: ['id asc'],
|
|
218
|
+
access: { 'maintenance.user': READ, 'maintenance.manager': ALL },
|
|
219
|
+
fields: {
|
|
220
|
+
plan: f.many2one('maintenance.plan', { required: true, ondelete: 'cascade' }),
|
|
221
|
+
name: f.char({ required: true }),
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
export const MaintenanceRequestTask = defineModel('maintenance.request.task', {
|
|
225
|
+
label: 'Checklist item',
|
|
226
|
+
order: ['id asc'],
|
|
227
|
+
access: {
|
|
228
|
+
'maintenance.user': ['read', 'write', 'create'],
|
|
229
|
+
'maintenance.manager': ALL,
|
|
230
|
+
},
|
|
231
|
+
fields: {
|
|
232
|
+
request: f.many2one('maintenance.request', { required: true, ondelete: 'cascade' }),
|
|
233
|
+
name: f.char({ required: true }),
|
|
234
|
+
done: f.boolean({ default: false }),
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
export const MaintenanceRequest = defineModel('maintenance.request', {
|
|
238
|
+
label: 'Maintenance order',
|
|
239
|
+
recName: 'name',
|
|
240
|
+
order: ['scheduledDate asc', 'id desc'],
|
|
241
|
+
companyScoped: { required: true },
|
|
242
|
+
tracking: ['state', 'assignedTo', 'scheduledDate'],
|
|
243
|
+
access: {
|
|
244
|
+
'maintenance.user': ['read', 'write', 'create'],
|
|
245
|
+
'maintenance.manager': [...ALL, 'export', 'import'],
|
|
246
|
+
},
|
|
247
|
+
fields: {
|
|
248
|
+
name: f.char({
|
|
249
|
+
required: true,
|
|
250
|
+
readonly: true,
|
|
251
|
+
sequence: { code: 'maintenance.request', dateField: 'scheduledDate' },
|
|
252
|
+
label: 'Reference',
|
|
253
|
+
}),
|
|
254
|
+
equipment: f.many2one('maintenance.equipment', { required: true, ondelete: 'restrict' }),
|
|
255
|
+
kind: f.selection({ preventive: 'Preventive', breakdown: 'Breakdown' }, { required: true, default: 'breakdown', label: 'Type' }),
|
|
256
|
+
plan: f.many2one('maintenance.plan', { ondelete: 'set null' }),
|
|
257
|
+
description: f.text({ label: 'What is wrong / what to do' }),
|
|
258
|
+
priority: f.selection({ low: 'Low', normal: 'Normal', high: 'High', urgent: 'Urgent' }, { required: true, default: 'normal' }),
|
|
259
|
+
scheduledDate: f.date({
|
|
260
|
+
required: true,
|
|
261
|
+
default: (env) => env.today(),
|
|
262
|
+
label: 'Planned for',
|
|
263
|
+
}),
|
|
264
|
+
assignedTo: f.many2one('res.users', { ondelete: 'set null', label: 'Technician' }),
|
|
265
|
+
reportedAt: f.datetime({ required: true, default: () => new Date(), label: 'Reported' }),
|
|
266
|
+
startedAt: f.datetime({ label: 'Started' }),
|
|
267
|
+
finishedAt: f.datetime({ label: 'Finished' }),
|
|
268
|
+
/** The equipment stood still from the report to the finish (breakdowns by default). */
|
|
269
|
+
downtime: f.boolean({ default: true, label: 'Equipment stopped' }),
|
|
270
|
+
downtimeHours: f.decimal({
|
|
271
|
+
scale: 2,
|
|
272
|
+
store: true,
|
|
273
|
+
label: 'Downtime (hours)',
|
|
274
|
+
...compute('maintenance.request', 'downtimeHours', ['downtime', 'reportedAt', 'finishedAt'], (requests) => {
|
|
275
|
+
for (const r of requests)
|
|
276
|
+
r.downtimeHours =
|
|
277
|
+
r.downtime && r.finishedAt !== null
|
|
278
|
+
? hoursBetween(r.reportedAt, r.finishedAt).toDecimalPlaces(2)
|
|
279
|
+
: zero;
|
|
280
|
+
}),
|
|
281
|
+
}),
|
|
282
|
+
labourHours: f.decimal({ scale: 2, default: '0', label: 'Labour (hours)' }),
|
|
283
|
+
/** The labour hours at the rate of App settings when the order was finished. */
|
|
284
|
+
labourCost: f.decimal({ scale: 2, default: '0', label: 'Labour cost' }),
|
|
285
|
+
tasks: f.one2many('maintenance.request.task', 'request', { label: 'Checklist' }),
|
|
286
|
+
note: f.text(),
|
|
287
|
+
state: f.state({
|
|
288
|
+
states: { new: 'New', progress: 'In progress', done: 'Done', cancel: 'Cancelled' },
|
|
289
|
+
initial: 'new',
|
|
290
|
+
transitions: {
|
|
291
|
+
start: {
|
|
292
|
+
from: ['new'],
|
|
293
|
+
to: 'progress',
|
|
294
|
+
after: records('maintenance.request', async (requests) => {
|
|
295
|
+
await requests.write({ startedAt: new Date() });
|
|
296
|
+
await requests.env
|
|
297
|
+
.model('maintenance.request')
|
|
298
|
+
.browse(requests.ids)
|
|
299
|
+
.started();
|
|
300
|
+
}),
|
|
301
|
+
},
|
|
302
|
+
finish: {
|
|
303
|
+
from: ['progress'],
|
|
304
|
+
to: 'done',
|
|
305
|
+
guard: records('maintenance.request', async (requests) => (await requests.load({ tasks: true })).filter((r) => [...r.tasks].some((t) => !t.done))),
|
|
306
|
+
message: 'Tick every item of the checklist first.',
|
|
307
|
+
// What other apps need done first (maintenance_stock: the parts consumed); refusing refuses the finish.
|
|
308
|
+
before: records('maintenance.request', async (requests) => {
|
|
309
|
+
await requests.env
|
|
310
|
+
.model('maintenance.request')
|
|
311
|
+
.browse(requests.ids)
|
|
312
|
+
.finishing();
|
|
313
|
+
}),
|
|
314
|
+
// Done: when, the labour's cost, and a preventive order moves its plan on.
|
|
315
|
+
after: records('maintenance.request', async (requests) => {
|
|
316
|
+
const env = requests.env;
|
|
317
|
+
const rate = await labourRate(env);
|
|
318
|
+
await requests.write({ finishedAt: new Date() });
|
|
319
|
+
for (const r of await requests.load({}))
|
|
320
|
+
await r.write({
|
|
321
|
+
labourCost: (r.labourHours ?? zero).times(rate).toDecimalPlaces(2),
|
|
322
|
+
});
|
|
323
|
+
await env.asSuperuser({ reason: 'preventive plan done' }, async (su) => {
|
|
324
|
+
for (const r of await su
|
|
325
|
+
.model('maintenance.request')
|
|
326
|
+
.browse(requests.ids)
|
|
327
|
+
.load({ plan: { meter: true } })) {
|
|
328
|
+
if (r.plan === null)
|
|
329
|
+
continue;
|
|
330
|
+
await su
|
|
331
|
+
.model('maintenance.plan')
|
|
332
|
+
.browse([r.plan.id])
|
|
333
|
+
.write({ lastDoneDate: su.today(), lastDoneValue: r.plan.meter?.value ?? null });
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}),
|
|
337
|
+
},
|
|
338
|
+
cancel: {
|
|
339
|
+
from: ['new', 'progress'],
|
|
340
|
+
to: 'cancel',
|
|
341
|
+
after: records('maintenance.request', async (requests) => {
|
|
342
|
+
await requests.env
|
|
343
|
+
.model('maintenance.request')
|
|
344
|
+
.browse(requests.ids)
|
|
345
|
+
.cancelled();
|
|
346
|
+
}),
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
}),
|
|
350
|
+
},
|
|
351
|
+
methods: {
|
|
352
|
+
/** Runs once these orders are started. Nothing here; `maintenance_stock` reserves their parts. */
|
|
353
|
+
started: method('maintenance.request', async () => undefined),
|
|
354
|
+
/**
|
|
355
|
+
* Runs before these orders are finished; throwing refuses the finish. Nothing here; `maintenance_stock`
|
|
356
|
+
* consumes their parts (refused when some are short).
|
|
357
|
+
*/
|
|
358
|
+
finishing: method('maintenance.request', async () => undefined),
|
|
359
|
+
/** Runs once these orders are cancelled. Nothing here; `maintenance_stock` releases their parts. */
|
|
360
|
+
cancelled: method('maintenance.request', async () => undefined),
|
|
361
|
+
},
|
|
362
|
+
});
|
|
363
|
+
/**
|
|
364
|
+
* Makes the maintenance order of every active plan that is due (by time within the lead time, by meter once the
|
|
365
|
+
* meter passed its interval) and has no open order, with its checklist. Returns how many were made.
|
|
366
|
+
*/
|
|
367
|
+
export async function runPlans(env) {
|
|
368
|
+
const lead = await leadDays(env);
|
|
369
|
+
return env.asSuperuser({ reason: 'preventive plans' }, async (su) => {
|
|
370
|
+
const today = iso(su.today());
|
|
371
|
+
let made = 0;
|
|
372
|
+
const plans = await (await su.model('maintenance.plan').search({})).load({
|
|
373
|
+
meter: true,
|
|
374
|
+
tasks: true,
|
|
375
|
+
equipment: true,
|
|
376
|
+
});
|
|
377
|
+
for (const p of plans) {
|
|
378
|
+
if (!p.equipment.active)
|
|
379
|
+
continue;
|
|
380
|
+
const open = await su.model('maintenance.request').search({
|
|
381
|
+
where: { plan: p.id, state: { in: [...OPEN] } },
|
|
382
|
+
limit: 1,
|
|
383
|
+
});
|
|
384
|
+
if (open.length > 0)
|
|
385
|
+
continue;
|
|
386
|
+
let due = null;
|
|
387
|
+
if (p.trigger === 'time' && p.nextDate !== null) {
|
|
388
|
+
const next = iso(p.nextDate);
|
|
389
|
+
if (next <= addDays(today, lead))
|
|
390
|
+
due = next < today ? today : next;
|
|
391
|
+
}
|
|
392
|
+
else if (p.trigger === 'meter' && p.meter !== null && p.intervalValue !== null) {
|
|
393
|
+
if ((p.meter.value ?? zero).gte((p.lastDoneValue ?? zero).plus(p.intervalValue)))
|
|
394
|
+
due = today;
|
|
395
|
+
}
|
|
396
|
+
if (due === null)
|
|
397
|
+
continue;
|
|
398
|
+
await su.model('maintenance.request').create([
|
|
399
|
+
{
|
|
400
|
+
equipment: p.equipment.id,
|
|
401
|
+
company: p.company.id,
|
|
402
|
+
kind: 'preventive',
|
|
403
|
+
plan: p.id,
|
|
404
|
+
description: p.name,
|
|
405
|
+
scheduledDate: due,
|
|
406
|
+
downtime: false,
|
|
407
|
+
assignedTo: p.equipment.responsible?.id ?? null,
|
|
408
|
+
tasks: { create: [...p.tasks].map((t) => ({ name: t.name })) },
|
|
409
|
+
},
|
|
410
|
+
]);
|
|
411
|
+
made += 1;
|
|
412
|
+
}
|
|
413
|
+
await su.flush();
|
|
414
|
+
return made;
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
export const maintenanceShutro = defineModule({
|
|
418
|
+
name: 'maintenance',
|
|
419
|
+
version: '0.1.0',
|
|
420
|
+
depends: [contactsShutro, messagingShutro],
|
|
421
|
+
groups: [
|
|
422
|
+
orm.defineGroup({ code: 'maintenance.user', label: 'Technician', implies: ['base.user'] }),
|
|
423
|
+
orm.defineGroup({
|
|
424
|
+
code: 'maintenance.manager',
|
|
425
|
+
label: 'Asset Care manager',
|
|
426
|
+
implies: ['maintenance.user'],
|
|
427
|
+
}),
|
|
428
|
+
],
|
|
429
|
+
sequences: [
|
|
430
|
+
orm.defineSequence({
|
|
431
|
+
code: 'maintenance.request',
|
|
432
|
+
prefix: 'MT/{year}/',
|
|
433
|
+
padding: 5,
|
|
434
|
+
reset: 'yearly',
|
|
435
|
+
}),
|
|
436
|
+
],
|
|
437
|
+
models: [
|
|
438
|
+
MaintenanceEquipment,
|
|
439
|
+
MaintenanceMeter,
|
|
440
|
+
MaintenanceMeterReading,
|
|
441
|
+
MaintenancePlan,
|
|
442
|
+
MaintenancePlanTask,
|
|
443
|
+
MaintenanceRequest,
|
|
444
|
+
MaintenanceRequestTask,
|
|
445
|
+
],
|
|
446
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { defineModel, defineModule, extendModel, f, replace } from '../../server/orm.js';
|
|
2
|
+
import { type DefinitionHelpers } from '../../server/orm.js';
|
|
3
|
+
import type { DefaultLoaded, Env as CoreEnv, RecordSet as CoreRecordSet, Shutro as CoreShutro } from '../../server/orm.js';
|
|
4
|
+
import type { SchemaView } from './schema.js';
|
|
5
|
+
export type { SchemaView };
|
|
6
|
+
/** Every model visible in this view. */
|
|
7
|
+
export type ModelName = keyof SchemaView & string;
|
|
8
|
+
/** `Env` typed to this view. */
|
|
9
|
+
export type Env = CoreEnv<SchemaView>;
|
|
10
|
+
/** `Shutro` typed to this view. */
|
|
11
|
+
export type Shutro = CoreShutro<SchemaView>;
|
|
12
|
+
/** A recordset of `M`, with the default loaded shape unless `L` is given. */
|
|
13
|
+
export type Records<M extends ModelName, L = DefaultLoaded<SchemaView, M>> = CoreRecordSet<SchemaView, M, L>;
|
|
14
|
+
export declare const compute: DefinitionHelpers<SchemaView>['compute'];
|
|
15
|
+
export declare const check: DefinitionHelpers<SchemaView>['check'];
|
|
16
|
+
export declare const onchange: DefinitionHelpers<SchemaView>['onchange'];
|
|
17
|
+
export declare const records: DefinitionHelpers<SchemaView>['records'];
|
|
18
|
+
export declare const method: DefinitionHelpers<SchemaView>['method'];
|
|
19
|
+
/** Module data (RFC 0017): records, overrides of dependencies' records, and references, typed like creates. */
|
|
20
|
+
export declare const record: DefinitionHelpers<SchemaView>['record'];
|
|
21
|
+
export declare const override: DefinitionHelpers<SchemaView>['override'];
|
|
22
|
+
export declare const ref: DefinitionHelpers<SchemaView>['ref'];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// GENERATED by `pnpm generate:models` (Shutro’s generator). Do not edit. definitions-hash: 28061ca642f269ff
|
|
2
|
+
// Bindings of module `maintenance_stock`: import the definition API from here to get types scoped to what it can see.
|
|
3
|
+
export { defineModel, defineModule, extendModel, f, replace } from '../../server/orm.js';
|
|
4
|
+
import { definitions } from '../../server/orm.js';
|
|
5
|
+
/** Definition callbacks typed against this module's view: no casts in computes, checks, onchange, methods. */
|
|
6
|
+
const helpers = definitions();
|
|
7
|
+
export const compute = helpers.compute;
|
|
8
|
+
export const check = helpers.check;
|
|
9
|
+
export const onchange = helpers.onchange;
|
|
10
|
+
export const records = helpers.records;
|
|
11
|
+
export const method = helpers.method;
|
|
12
|
+
/** Module data (RFC 0017): records, overrides of dependencies' records, and references, typed like creates. */
|
|
13
|
+
export const record = helpers.record;
|
|
14
|
+
export const override = helpers.override;
|
|
15
|
+
export const ref = helpers.ref;
|