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,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Depreciation boards (RFC 0024 §2.5), without a database: the planned month-end amounts of an asset from its value,
|
|
3
|
+
* salvage value, method and life. Exact in Decimals; the last line takes the rounding so the board ends at the
|
|
4
|
+
* salvage value.
|
|
5
|
+
*
|
|
6
|
+
* - **Straight line**: the depreciable amount over the life in months; with prorata the first month counts only the
|
|
7
|
+
* days from the date of use, and one more month at the end takes the rest.
|
|
8
|
+
* - **Declining balance**: the annual rate on what remains, a twelfth a month — switching to straight line over the
|
|
9
|
+
* months left as soon as that is more, so the asset reaches its salvage value at the end of its life.
|
|
10
|
+
* - **Units of production**: no plan ahead; each month's usage at the depreciable amount per unit (`unitsLine`).
|
|
11
|
+
*/
|
|
12
|
+
import { type Decimal } from '../server/orm.js';
|
|
13
|
+
export interface BoardInput {
|
|
14
|
+
/** What remains to depreciate from, at `from` (the cost, or the book value after a revaluation). */
|
|
15
|
+
readonly bookValue: Decimal;
|
|
16
|
+
readonly salvage: Decimal;
|
|
17
|
+
readonly method: 'linear' | 'degressive' | 'units';
|
|
18
|
+
/** Months left in the asset's life from `from`. */
|
|
19
|
+
readonly months: number;
|
|
20
|
+
/** Declining balance: the yearly rate in percent. */
|
|
21
|
+
readonly rate: Decimal;
|
|
22
|
+
/** The date depreciation starts (`YYYY-MM-DD`): the date of use, or the day after the last posted month. */
|
|
23
|
+
readonly from: string;
|
|
24
|
+
/** The first month only from the date (`true`), or in full. */
|
|
25
|
+
readonly prorata: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface BoardLine {
|
|
28
|
+
/** The month's last day, `YYYY-MM-DD`. */
|
|
29
|
+
readonly date: string;
|
|
30
|
+
readonly amount: Decimal;
|
|
31
|
+
/** Depreciated so far on this board, this line included. */
|
|
32
|
+
readonly accumulated: Decimal;
|
|
33
|
+
/** The book value after this line. */
|
|
34
|
+
readonly remaining: Decimal;
|
|
35
|
+
}
|
|
36
|
+
/** The planned lines of a board. Units of production plans nothing ahead. */
|
|
37
|
+
export declare function board(input: BoardInput): BoardLine[];
|
|
38
|
+
/** Units of production: the month's depreciation for `units` used, never past the salvage value. */
|
|
39
|
+
export declare function unitsLine(input: {
|
|
40
|
+
readonly cost: Decimal;
|
|
41
|
+
readonly salvage: Decimal;
|
|
42
|
+
readonly totalUnits: Decimal;
|
|
43
|
+
readonly units: Decimal;
|
|
44
|
+
readonly depreciated: Decimal;
|
|
45
|
+
}): Decimal;
|
|
46
|
+
/**
|
|
47
|
+
* A tax book (reducing balance at a yearly rate, a full year in the year of acquisition — as Bangladesh's Third
|
|
48
|
+
* Schedule reads; verify for the year): the written-down value at the start of each income year, its depreciation,
|
|
49
|
+
* and the value at its end, from the year of acquisition to `throughYear` (each year by its start, `YYYY`).
|
|
50
|
+
*/
|
|
51
|
+
export declare function taxBook(input: {
|
|
52
|
+
readonly cost: Decimal;
|
|
53
|
+
readonly rate: Decimal;
|
|
54
|
+
readonly acquiredYear: number;
|
|
55
|
+
readonly throughYear: number;
|
|
56
|
+
}): {
|
|
57
|
+
year: number;
|
|
58
|
+
opening: Decimal;
|
|
59
|
+
depreciation: Decimal;
|
|
60
|
+
closing: Decimal;
|
|
61
|
+
}[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Depreciation boards (RFC 0024 §2.5), without a database: the planned month-end amounts of an asset from its value,
|
|
3
|
+
* salvage value, method and life. Exact in Decimals; the last line takes the rounding so the board ends at the
|
|
4
|
+
* salvage value.
|
|
5
|
+
*
|
|
6
|
+
* - **Straight line**: the depreciable amount over the life in months; with prorata the first month counts only the
|
|
7
|
+
* days from the date of use, and one more month at the end takes the rest.
|
|
8
|
+
* - **Declining balance**: the annual rate on what remains, a twelfth a month — switching to straight line over the
|
|
9
|
+
* months left as soon as that is more, so the asset reaches its salvage value at the end of its life.
|
|
10
|
+
* - **Units of production**: no plan ahead; each month's usage at the depreciable amount per unit (`unitsLine`).
|
|
11
|
+
*/
|
|
12
|
+
import { orm } from '../server/orm.js';
|
|
13
|
+
const ZERO = orm.toDecimal(0);
|
|
14
|
+
const monthEnd = (y, m) => new Date(Date.UTC(y, m, 0)).toISOString().slice(0, 10);
|
|
15
|
+
const money = (d) => d.toDecimalPlaces(2);
|
|
16
|
+
/** The planned lines of a board. Units of production plans nothing ahead. */
|
|
17
|
+
export function board(input) {
|
|
18
|
+
if (input.method === 'units' || input.months <= 0)
|
|
19
|
+
return [];
|
|
20
|
+
const [y0, m0, d0] = input.from.split('-').map(Number);
|
|
21
|
+
const daysInFirst = new Date(Date.UTC(y0, m0, 0)).getUTCDate();
|
|
22
|
+
const firstShare = input.prorata
|
|
23
|
+
? orm.toDecimal(daysInFirst - d0 + 1).div(daysInFirst)
|
|
24
|
+
: orm.toDecimal(1);
|
|
25
|
+
const partial = input.prorata && d0 > 1;
|
|
26
|
+
const depreciable = input.bookValue.minus(input.salvage);
|
|
27
|
+
if (depreciable.lte(0))
|
|
28
|
+
return [];
|
|
29
|
+
const count = input.months + (partial ? 1 : 0);
|
|
30
|
+
const lines = [];
|
|
31
|
+
let accumulated = ZERO;
|
|
32
|
+
for (let i = 0; i < count; i += 1) {
|
|
33
|
+
const y = y0 + Math.floor((m0 - 1 + i) / 12);
|
|
34
|
+
const m = ((m0 - 1 + i) % 12) + 1;
|
|
35
|
+
const left = depreciable.minus(accumulated);
|
|
36
|
+
if (left.lte(0))
|
|
37
|
+
break;
|
|
38
|
+
let amount;
|
|
39
|
+
if (i === count - 1)
|
|
40
|
+
amount = left;
|
|
41
|
+
else if (input.method === 'linear') {
|
|
42
|
+
const monthly = depreciable.div(input.months);
|
|
43
|
+
amount = money(i === 0 ? monthly.times(firstShare) : monthly);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const declining = input.bookValue.minus(accumulated).times(input.rate).div(1200);
|
|
47
|
+
const straight = left.div(count - i);
|
|
48
|
+
const base = declining.gt(straight) ? declining : straight;
|
|
49
|
+
amount = money(i === 0 ? base.times(firstShare) : base);
|
|
50
|
+
}
|
|
51
|
+
if (amount.gt(left))
|
|
52
|
+
amount = left;
|
|
53
|
+
accumulated = accumulated.plus(amount);
|
|
54
|
+
lines.push({
|
|
55
|
+
date: monthEnd(y, m),
|
|
56
|
+
amount,
|
|
57
|
+
accumulated,
|
|
58
|
+
remaining: input.bookValue.minus(accumulated),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return lines;
|
|
62
|
+
}
|
|
63
|
+
/** Units of production: the month's depreciation for `units` used, never past the salvage value. */
|
|
64
|
+
export function unitsLine(input) {
|
|
65
|
+
if (input.totalUnits.lte(0))
|
|
66
|
+
return ZERO;
|
|
67
|
+
const depreciable = input.cost.minus(input.salvage);
|
|
68
|
+
const left = depreciable.minus(input.depreciated);
|
|
69
|
+
const amount = money(depreciable.div(input.totalUnits).times(input.units));
|
|
70
|
+
return amount.gt(left) ? (left.gt(0) ? left : ZERO) : amount;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A tax book (reducing balance at a yearly rate, a full year in the year of acquisition — as Bangladesh's Third
|
|
74
|
+
* Schedule reads; verify for the year): the written-down value at the start of each income year, its depreciation,
|
|
75
|
+
* and the value at its end, from the year of acquisition to `throughYear` (each year by its start, `YYYY`).
|
|
76
|
+
*/
|
|
77
|
+
export function taxBook(input) {
|
|
78
|
+
const out = [];
|
|
79
|
+
let wdv = input.cost;
|
|
80
|
+
for (let year = input.acquiredYear; year <= input.throughYear; year += 1) {
|
|
81
|
+
const depreciation = money(wdv.times(input.rate).div(100));
|
|
82
|
+
out.push({ year, opening: wdv, depreciation, closing: wdv.minus(depreciation) });
|
|
83
|
+
wdv = wdv.minus(depreciation);
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed assets in the books (RFC 0024 §2.5): the board planned on confirmation and after a revaluation, the lines due
|
|
3
|
+
* posted once each (Depreciation expense against Accumulated depreciation, in the category's journal, with the
|
|
4
|
+
* asset's cost centre), units of production from each month's usage, disposal or sale with its gain or loss,
|
|
5
|
+
* revaluation and impairment, draft assets from posted bills, and the tax book beside the accounting book.
|
|
6
|
+
*/
|
|
7
|
+
import { type Decimal, type Id } from '../server/orm.js';
|
|
8
|
+
import type { Env } from './.kosh/bindings.js';
|
|
9
|
+
/** A date-only value as `YYYY-MM-DD` (PostgreSQL dates read as local midnights). */
|
|
10
|
+
export declare function isoDate(v: unknown): string;
|
|
11
|
+
/** Plans (again) the boards of the assets: what is not posted yet is replaced, from what remains. */
|
|
12
|
+
export declare function planBoard(env: Env, ids: readonly number[]): Promise<void>;
|
|
13
|
+
/** Posts every running asset's lines due on or before `upTo` (units of production: from the usage); returns how many. */
|
|
14
|
+
export declare function postDue(env: Env, upTo: string, only?: readonly number[]): Promise<number>;
|
|
15
|
+
/** Disposes of (or sells) an asset on `date`: depreciation up to then, the asset out, the gain or loss booked. */
|
|
16
|
+
export declare function dispose(env: Env, id: number, input: {
|
|
17
|
+
readonly date: string;
|
|
18
|
+
readonly proceeds: Decimal;
|
|
19
|
+
readonly account: number | null;
|
|
20
|
+
}): Promise<Id<'account.move'>>;
|
|
21
|
+
/** Revalues an asset to `value` on `date` (an impairment when lower); the rest of its board planned again. */
|
|
22
|
+
export declare function revalue(env: Env, id: number, input: {
|
|
23
|
+
readonly date: string;
|
|
24
|
+
readonly value: Decimal;
|
|
25
|
+
}): Promise<Id<'account.move'>>;
|
|
26
|
+
/** A posted bill's lines on an asset category's asset account become draft assets, once each. */
|
|
27
|
+
export declare function assetsFromBill(env: Env, moveId: number): Promise<number>;
|
|
28
|
+
export interface TaxBookRow {
|
|
29
|
+
readonly asset: number;
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly category: string;
|
|
32
|
+
readonly rate: string;
|
|
33
|
+
readonly opening: string;
|
|
34
|
+
readonly taxDepreciation: string;
|
|
35
|
+
readonly closing: string;
|
|
36
|
+
readonly bookDepreciation: string;
|
|
37
|
+
readonly bookValue: string;
|
|
38
|
+
/** The book value less the tax value at the year's end: the temporary difference for deferred tax. */
|
|
39
|
+
readonly difference: string;
|
|
40
|
+
}
|
|
41
|
+
/** The tax book of the fiscal year starting in `year` beside the accounting book, asset by asset. */
|
|
42
|
+
export declare function taxBookOf(env: Env, year: number): Promise<TaxBookRow[]>;
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed assets in the books (RFC 0024 §2.5): the board planned on confirmation and after a revaluation, the lines due
|
|
3
|
+
* posted once each (Depreciation expense against Accumulated depreciation, in the category's journal, with the
|
|
4
|
+
* asset's cost centre), units of production from each month's usage, disposal or sale with its gain or loss,
|
|
5
|
+
* revaluation and impairment, draft assets from posted bills, and the tax book beside the accounting book.
|
|
6
|
+
*/
|
|
7
|
+
import { orm } from '../server/orm.js';
|
|
8
|
+
import { board, taxBook, unitsLine } from './board.js';
|
|
9
|
+
const ZERO = orm.toDecimal(0);
|
|
10
|
+
/** A date-only value as `YYYY-MM-DD` (PostgreSQL dates read as local midnights). */
|
|
11
|
+
export function isoDate(v) {
|
|
12
|
+
if (!(v instanceof Date))
|
|
13
|
+
return String(v ?? '').slice(0, 10);
|
|
14
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
15
|
+
return `${v.getFullYear()}-${pad(v.getMonth() + 1)}-${pad(v.getDate())}`;
|
|
16
|
+
}
|
|
17
|
+
const nextDay = (date) => new Date(Date.parse(`${date}T00:00:00Z`) + 86_400_000).toISOString().slice(0, 10);
|
|
18
|
+
async function post(env, company, journal, date, ref, lines) {
|
|
19
|
+
const [c] = await env.model('res.company').browse([company]).load({});
|
|
20
|
+
const made = await env.model('account.move').create([
|
|
21
|
+
{
|
|
22
|
+
kind: 'entry',
|
|
23
|
+
journal,
|
|
24
|
+
company,
|
|
25
|
+
currency: c?.currency.id,
|
|
26
|
+
date,
|
|
27
|
+
ref,
|
|
28
|
+
lines: {
|
|
29
|
+
create: lines
|
|
30
|
+
.filter((l) => !l.debit.isZero() || !l.credit.isZero())
|
|
31
|
+
.map((l) => ({
|
|
32
|
+
account: l.account,
|
|
33
|
+
name: l.name,
|
|
34
|
+
analytic: l.analytic ?? null,
|
|
35
|
+
debit: l.debit.toDecimalPlaces(2).toString(),
|
|
36
|
+
credit: l.credit.toDecimalPlaces(2).toString(),
|
|
37
|
+
})),
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
await env.withGrants({ grants: ['account.post'], reason: `asset ${ref}` }, (e) => e.model('account.move').browse(made.ids).post());
|
|
42
|
+
return made.ids[0];
|
|
43
|
+
}
|
|
44
|
+
/** An account of the company by code, made when missing. */
|
|
45
|
+
async function accountByCode(env, company, spec) {
|
|
46
|
+
return ((await env.model('account.account').search({ where: { company, code: spec.code }, limit: 1 })).ids[0] ??
|
|
47
|
+
(await env.model('account.account').create([{ ...spec, company }]))
|
|
48
|
+
.ids[0]);
|
|
49
|
+
}
|
|
50
|
+
/** Plans (again) the boards of the assets: what is not posted yet is replaced, from what remains. */
|
|
51
|
+
export async function planBoard(env, ids) {
|
|
52
|
+
for (const a of await env
|
|
53
|
+
.model('account.asset')
|
|
54
|
+
.browse(ids)
|
|
55
|
+
.load({ lines: true })) {
|
|
56
|
+
const planned = [...a.lines].filter((l) => !l.posted).map((l) => l.id);
|
|
57
|
+
if (planned.length > 0)
|
|
58
|
+
await env.model('account.asset.line').browse(planned).unlink();
|
|
59
|
+
const posted = [...a.lines]
|
|
60
|
+
.filter((l) => l.posted)
|
|
61
|
+
.sort((x, y) => isoDate(x.date).localeCompare(isoDate(y.date)));
|
|
62
|
+
const months = posted.filter((l) => l.kind === 'depreciation').length;
|
|
63
|
+
const revalued = posted
|
|
64
|
+
.filter((l) => l.kind === 'revaluation')
|
|
65
|
+
.reduce((s, l) => s.plus(l.amount), ZERO);
|
|
66
|
+
const lowered = posted
|
|
67
|
+
.filter((l) => l.kind === 'depreciation' || l.kind === 'impairment')
|
|
68
|
+
.reduce((s, l) => s.plus(l.amount), ZERO);
|
|
69
|
+
const last = posted.filter((l) => l.kind === 'depreciation').at(-1);
|
|
70
|
+
const lines = board({
|
|
71
|
+
bookValue: a.value.plus(revalued).minus(lowered),
|
|
72
|
+
salvage: a.salvage,
|
|
73
|
+
method: a.method,
|
|
74
|
+
months: a.lifeMonths - months,
|
|
75
|
+
rate: a.rate ?? ZERO,
|
|
76
|
+
from: last === undefined ? isoDate(a.dateInUse) : nextDay(isoDate(last.date)),
|
|
77
|
+
prorata: last === undefined && a.prorata,
|
|
78
|
+
});
|
|
79
|
+
if (lines.length > 0)
|
|
80
|
+
await env.model('account.asset.line').create(lines.map((l) => ({
|
|
81
|
+
asset: a.id,
|
|
82
|
+
date: l.date,
|
|
83
|
+
kind: 'depreciation',
|
|
84
|
+
amount: l.amount.toString(),
|
|
85
|
+
})));
|
|
86
|
+
}
|
|
87
|
+
await env.flush();
|
|
88
|
+
}
|
|
89
|
+
/** Posts every running asset's lines due on or before `upTo` (units of production: from the usage); returns how many. */
|
|
90
|
+
export async function postDue(env, upTo, only) {
|
|
91
|
+
let count = 0;
|
|
92
|
+
const assets = await (await env.model('account.asset').search({
|
|
93
|
+
where: { state: 'running', ...(only === undefined ? {} : { id: { in: only } }) },
|
|
94
|
+
})).load({ category: true, lines: true, usage: true });
|
|
95
|
+
for (const a of assets) {
|
|
96
|
+
// Units of production: a line for each month's usage not depreciated yet.
|
|
97
|
+
if (a.method === 'units') {
|
|
98
|
+
let depreciated = [...a.lines]
|
|
99
|
+
.filter((l) => l.kind === 'depreciation')
|
|
100
|
+
.reduce((s, l) => s.plus(l.amount), ZERO);
|
|
101
|
+
for (const u of [...a.usage].filter((u) => u.line === null && isoDate(u.date) <= upTo)) {
|
|
102
|
+
const amount = unitsLine({
|
|
103
|
+
cost: a.value,
|
|
104
|
+
salvage: a.salvage,
|
|
105
|
+
totalUnits: a.totalUnits ?? ZERO,
|
|
106
|
+
units: u.units,
|
|
107
|
+
depreciated,
|
|
108
|
+
});
|
|
109
|
+
if (amount.lte(0))
|
|
110
|
+
continue;
|
|
111
|
+
const made = await env.model('account.asset.line').create([
|
|
112
|
+
{
|
|
113
|
+
asset: a.id,
|
|
114
|
+
date: isoDate(u.date),
|
|
115
|
+
kind: 'depreciation',
|
|
116
|
+
amount: amount.toString(),
|
|
117
|
+
},
|
|
118
|
+
]);
|
|
119
|
+
await env
|
|
120
|
+
.model('account.asset.usage')
|
|
121
|
+
.browse([u.id])
|
|
122
|
+
.write({ line: made.ids[0] });
|
|
123
|
+
depreciated = depreciated.plus(amount);
|
|
124
|
+
}
|
|
125
|
+
await env.flush();
|
|
126
|
+
}
|
|
127
|
+
const due = [
|
|
128
|
+
...(await (await env.model('account.asset.line').search({
|
|
129
|
+
where: { asset: a.id, kind: 'depreciation', posted: false, date: { lte: upTo } },
|
|
130
|
+
order: ['date asc'],
|
|
131
|
+
})).load(['date', 'amount'])),
|
|
132
|
+
];
|
|
133
|
+
for (const l of due) {
|
|
134
|
+
const move = await post(env, a.company.id, a.category.journal.id, isoDate(l.date), `${a.name} depreciation`, [
|
|
135
|
+
{
|
|
136
|
+
account: a.category.expenseAccount.id,
|
|
137
|
+
debit: l.amount,
|
|
138
|
+
credit: ZERO,
|
|
139
|
+
name: a.name,
|
|
140
|
+
analytic: a.analytic?.id ?? null,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
account: a.category.accumulatedAccount.id,
|
|
144
|
+
debit: ZERO,
|
|
145
|
+
credit: l.amount,
|
|
146
|
+
name: a.name,
|
|
147
|
+
},
|
|
148
|
+
]);
|
|
149
|
+
await env
|
|
150
|
+
.model('account.asset.line')
|
|
151
|
+
.browse([l.id])
|
|
152
|
+
.write({ posted: true, move });
|
|
153
|
+
count += 1;
|
|
154
|
+
}
|
|
155
|
+
await env.flush();
|
|
156
|
+
// Fully depreciated: nothing left above the salvage value and nothing planned.
|
|
157
|
+
const [now] = await env.model('account.asset').browse([a.id]).load({ lines: true });
|
|
158
|
+
if (now !== undefined &&
|
|
159
|
+
a.method !== 'units' &&
|
|
160
|
+
[...now.lines].every((l) => l.posted) &&
|
|
161
|
+
(now.bookValue ?? ZERO).lte(now.salvage))
|
|
162
|
+
await env.model('account.asset').browse([a.id]).close();
|
|
163
|
+
}
|
|
164
|
+
await env.flush();
|
|
165
|
+
return count;
|
|
166
|
+
}
|
|
167
|
+
/** Disposes of (or sells) an asset on `date`: depreciation up to then, the asset out, the gain or loss booked. */
|
|
168
|
+
export async function dispose(env, id, input) {
|
|
169
|
+
await postDue(env, input.date, [id]);
|
|
170
|
+
const [a] = await env
|
|
171
|
+
.model('account.asset')
|
|
172
|
+
.browse([id])
|
|
173
|
+
.load({ category: true, lines: true });
|
|
174
|
+
if (a === undefined || a.state !== 'running')
|
|
175
|
+
throw new orm.ValidationError('account.asset', ['state'], 'Only a running asset is disposed of.', 'Confirm the asset first.');
|
|
176
|
+
if (input.proceeds.gt(0) && input.account === null)
|
|
177
|
+
throw new orm.ValidationError('account.asset', ['proceeds'], 'Say where the sale’s proceeds go.', 'Choose the receivable or bank account of the sale.');
|
|
178
|
+
const revalued = [...a.lines]
|
|
179
|
+
.filter((l) => l.posted && l.kind === 'revaluation')
|
|
180
|
+
.reduce((s, l) => s.plus(l.amount), ZERO);
|
|
181
|
+
const cost = a.value.plus(revalued);
|
|
182
|
+
const depreciated = a.depreciated ?? ZERO;
|
|
183
|
+
const book = cost.minus(depreciated);
|
|
184
|
+
const result = input.proceeds.minus(book);
|
|
185
|
+
const gain = a.category.gainAccount?.id ??
|
|
186
|
+
(await accountByCode(env, a.company.id, {
|
|
187
|
+
code: '4900',
|
|
188
|
+
name: 'Other income',
|
|
189
|
+
type: 'income_other',
|
|
190
|
+
}));
|
|
191
|
+
const loss = a.category.lossAccount?.id ?? a.category.expenseAccount.id;
|
|
192
|
+
const lines = [
|
|
193
|
+
{
|
|
194
|
+
account: a.category.accumulatedAccount.id,
|
|
195
|
+
debit: depreciated,
|
|
196
|
+
credit: ZERO,
|
|
197
|
+
name: `${a.name} disposed`,
|
|
198
|
+
},
|
|
199
|
+
{ account: a.category.assetAccount.id, debit: ZERO, credit: cost, name: `${a.name} disposed` },
|
|
200
|
+
];
|
|
201
|
+
if (input.proceeds.gt(0) && input.account !== null)
|
|
202
|
+
lines.push({
|
|
203
|
+
account: input.account,
|
|
204
|
+
debit: input.proceeds,
|
|
205
|
+
credit: ZERO,
|
|
206
|
+
name: `${a.name} sold`,
|
|
207
|
+
});
|
|
208
|
+
if (result.gt(0))
|
|
209
|
+
lines.push({ account: gain, debit: ZERO, credit: result, name: `${a.name} gain on disposal` });
|
|
210
|
+
if (result.lt(0))
|
|
211
|
+
lines.push({
|
|
212
|
+
account: loss,
|
|
213
|
+
debit: result.neg(),
|
|
214
|
+
credit: ZERO,
|
|
215
|
+
name: `${a.name} loss on disposal`,
|
|
216
|
+
});
|
|
217
|
+
const move = await post(env, a.company.id, a.category.journal.id, input.date, `${a.name} disposal`, lines);
|
|
218
|
+
const planned = [...a.lines].filter((l) => !l.posted).map((l) => l.id);
|
|
219
|
+
if (planned.length > 0)
|
|
220
|
+
await env.model('account.asset.line').browse(planned).unlink();
|
|
221
|
+
await env.model('account.asset.line').create([
|
|
222
|
+
{
|
|
223
|
+
asset: a.id,
|
|
224
|
+
date: input.date,
|
|
225
|
+
kind: 'disposal',
|
|
226
|
+
amount: book.toString(),
|
|
227
|
+
posted: true,
|
|
228
|
+
move,
|
|
229
|
+
},
|
|
230
|
+
]);
|
|
231
|
+
await env
|
|
232
|
+
.model('account.asset')
|
|
233
|
+
.browse([a.id])
|
|
234
|
+
.write({ disposedOn: input.date, proceeds: input.proceeds.toString() });
|
|
235
|
+
await env.flush();
|
|
236
|
+
await env.model('account.asset').browse([a.id]).dispose();
|
|
237
|
+
await env.flush();
|
|
238
|
+
await env.emit('account.asset.disposed', { id: a.id, proceeds: input.proceeds.toString() });
|
|
239
|
+
return move;
|
|
240
|
+
}
|
|
241
|
+
/** Revalues an asset to `value` on `date` (an impairment when lower); the rest of its board planned again. */
|
|
242
|
+
export async function revalue(env, id, input) {
|
|
243
|
+
await postDue(env, input.date, [id]);
|
|
244
|
+
const [a] = await env
|
|
245
|
+
.model('account.asset')
|
|
246
|
+
.browse([id])
|
|
247
|
+
.load({ category: true });
|
|
248
|
+
if (a === undefined || a.state !== 'running')
|
|
249
|
+
throw new orm.ValidationError('account.asset', ['state'], 'Only a running asset is revalued.', 'Confirm the asset first.');
|
|
250
|
+
const diff = input.value.minus(a.bookValue ?? ZERO);
|
|
251
|
+
if (diff.isZero())
|
|
252
|
+
throw new orm.ValidationError('account.asset', ['value'], 'That is its book value already.', 'Give the new value.');
|
|
253
|
+
let move;
|
|
254
|
+
if (diff.lt(0)) {
|
|
255
|
+
const loss = a.category.lossAccount?.id ?? a.category.expenseAccount.id;
|
|
256
|
+
move = await post(env, a.company.id, a.category.journal.id, input.date, `${a.name} impairment`, [
|
|
257
|
+
{
|
|
258
|
+
account: loss,
|
|
259
|
+
debit: diff.neg(),
|
|
260
|
+
credit: ZERO,
|
|
261
|
+
name: `${a.name} impairment`,
|
|
262
|
+
analytic: a.analytic?.id ?? null,
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
account: a.category.accumulatedAccount.id,
|
|
266
|
+
debit: ZERO,
|
|
267
|
+
credit: diff.neg(),
|
|
268
|
+
name: `${a.name} impairment`,
|
|
269
|
+
},
|
|
270
|
+
]);
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
const surplus = await accountByCode(env, a.company.id, {
|
|
274
|
+
code: '3150',
|
|
275
|
+
name: 'Revaluation surplus',
|
|
276
|
+
type: 'equity',
|
|
277
|
+
});
|
|
278
|
+
move = await post(env, a.company.id, a.category.journal.id, input.date, `${a.name} revaluation`, [
|
|
279
|
+
{
|
|
280
|
+
account: a.category.assetAccount.id,
|
|
281
|
+
debit: diff,
|
|
282
|
+
credit: ZERO,
|
|
283
|
+
name: `${a.name} revaluation`,
|
|
284
|
+
},
|
|
285
|
+
{ account: surplus, debit: ZERO, credit: diff, name: `${a.name} revaluation` },
|
|
286
|
+
]);
|
|
287
|
+
}
|
|
288
|
+
await env.model('account.asset.line').create([
|
|
289
|
+
{
|
|
290
|
+
asset: a.id,
|
|
291
|
+
date: input.date,
|
|
292
|
+
kind: diff.lt(0) ? 'impairment' : 'revaluation',
|
|
293
|
+
amount: diff.abs().toString(),
|
|
294
|
+
posted: true,
|
|
295
|
+
move,
|
|
296
|
+
},
|
|
297
|
+
]);
|
|
298
|
+
await env.flush();
|
|
299
|
+
await planBoard(env, [a.id]);
|
|
300
|
+
return move;
|
|
301
|
+
}
|
|
302
|
+
/** A posted bill's lines on an asset category's asset account become draft assets, once each. */
|
|
303
|
+
export async function assetsFromBill(env, moveId) {
|
|
304
|
+
const [bill] = await env
|
|
305
|
+
.model('account.move')
|
|
306
|
+
.browse([moveId])
|
|
307
|
+
.load({ lines: true, partner: true });
|
|
308
|
+
if (bill === undefined || bill.kind !== 'in_invoice' || bill.state !== 'posted')
|
|
309
|
+
return 0;
|
|
310
|
+
const categories = [
|
|
311
|
+
...(await (await env.model('account.asset.category').search({ where: { company: bill.company.id } })).load({
|
|
312
|
+
assetAccount: true,
|
|
313
|
+
})),
|
|
314
|
+
];
|
|
315
|
+
let made = 0;
|
|
316
|
+
for (const l of bill.lines) {
|
|
317
|
+
const category = categories.find((c) => c.assetAccount.id === l.account?.id);
|
|
318
|
+
if (category === undefined || l.debit.amount.lte(0))
|
|
319
|
+
continue;
|
|
320
|
+
if ((await env.model('account.asset').search({ where: { billLine: l.id }, limit: 1 })).length > 0)
|
|
321
|
+
continue;
|
|
322
|
+
await env.model('account.asset').create([
|
|
323
|
+
{
|
|
324
|
+
name: l.name ?? `${bill.name} line`,
|
|
325
|
+
category: category.id,
|
|
326
|
+
partner: bill.partner?.id ?? null,
|
|
327
|
+
bill: bill.id,
|
|
328
|
+
billLine: l.id,
|
|
329
|
+
analytic: l.analytic?.id ?? null,
|
|
330
|
+
company: bill.company.id,
|
|
331
|
+
value: l.debit.amount.toString(),
|
|
332
|
+
dateAcquired: isoDate(bill.date),
|
|
333
|
+
dateInUse: isoDate(bill.date),
|
|
334
|
+
method: category.method,
|
|
335
|
+
lifeMonths: category.lifeMonths,
|
|
336
|
+
rate: category.rate?.toString() ?? null,
|
|
337
|
+
prorata: category.prorata,
|
|
338
|
+
},
|
|
339
|
+
]);
|
|
340
|
+
made += 1;
|
|
341
|
+
}
|
|
342
|
+
await env.flush();
|
|
343
|
+
return made;
|
|
344
|
+
}
|
|
345
|
+
/** The first day of the company's fiscal year that contains `date`. */
|
|
346
|
+
function fiscalYearOf(date, startMonth) {
|
|
347
|
+
const [y, m] = date.split('-').map(Number);
|
|
348
|
+
return m >= startMonth ? y : y - 1;
|
|
349
|
+
}
|
|
350
|
+
/** The tax book of the fiscal year starting in `year` beside the accounting book, asset by asset. */
|
|
351
|
+
export async function taxBookOf(env, year) {
|
|
352
|
+
const [company] = await env
|
|
353
|
+
.model('res.company')
|
|
354
|
+
.browse([env.companyId])
|
|
355
|
+
.load(['fiscalYearStart']);
|
|
356
|
+
const start = Number(company?.fiscalYearStart ?? 1);
|
|
357
|
+
const from = `${year}-${String(start).padStart(2, '0')}-01`;
|
|
358
|
+
const to = new Date(Date.UTC(year + 1, start - 1, 0)).toISOString().slice(0, 10);
|
|
359
|
+
const rows = [];
|
|
360
|
+
for (const a of await (await env
|
|
361
|
+
.model('account.asset')
|
|
362
|
+
.search({ where: { state: { ne: 'draft' }, dateAcquired: { lte: to } } })).load({ category: true, lines: true })) {
|
|
363
|
+
if (a.disposedOn !== null && isoDate(a.disposedOn) < from)
|
|
364
|
+
continue;
|
|
365
|
+
const rate = a.category.taxRate ?? ZERO;
|
|
366
|
+
const years = taxBook({
|
|
367
|
+
cost: a.value,
|
|
368
|
+
rate,
|
|
369
|
+
acquiredYear: fiscalYearOf(isoDate(a.dateAcquired), start),
|
|
370
|
+
throughYear: year,
|
|
371
|
+
});
|
|
372
|
+
const row = years.at(-1);
|
|
373
|
+
if (row === undefined)
|
|
374
|
+
continue;
|
|
375
|
+
const inYear = [...a.lines].filter((l) => l.kind === 'depreciation' && isoDate(l.date) >= from && isoDate(l.date) <= to);
|
|
376
|
+
const upTo = [...a.lines].filter((l) => isoDate(l.date) <= to);
|
|
377
|
+
const lowered = upTo
|
|
378
|
+
.filter((l) => l.kind === 'depreciation' || l.kind === 'impairment')
|
|
379
|
+
.reduce((s, l) => s.plus(l.amount), ZERO);
|
|
380
|
+
const raised = upTo
|
|
381
|
+
.filter((l) => l.kind === 'revaluation')
|
|
382
|
+
.reduce((s, l) => s.plus(l.amount), ZERO);
|
|
383
|
+
const book = a.value.plus(raised).minus(lowered);
|
|
384
|
+
rows.push({
|
|
385
|
+
asset: a.id,
|
|
386
|
+
name: a.name,
|
|
387
|
+
category: a.category.name,
|
|
388
|
+
rate: rate.toString(),
|
|
389
|
+
opening: row.opening.toFixed(2),
|
|
390
|
+
taxDepreciation: row.depreciation.toFixed(2),
|
|
391
|
+
closing: row.closing.toFixed(2),
|
|
392
|
+
bookDepreciation: inYear.reduce((s, l) => s.plus(l.amount), ZERO).toFixed(2),
|
|
393
|
+
bookValue: book.toFixed(2),
|
|
394
|
+
difference: book.minus(row.closing).toFixed(2),
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
return rows;
|
|
398
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed assets' demo data (RFC 0008 §5.8): three categories — office equipment, computers, vehicles — with the tax
|
|
3
|
+
* book's rates (Bangladesh's Third Schedule as last known: verify), a set of laptops bought fourteen months ago and
|
|
4
|
+
* a delivery van on declining balance, both confirmed with their months so far posted.
|
|
5
|
+
*/
|
|
6
|
+
import type { DemoContext } from '../modules-sdk/index.js';
|
|
7
|
+
export declare function assetDemo(ctx: DemoContext): Promise<string>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { postDue } from './books.js';
|
|
2
|
+
const DINA = { login: 'dina', name: 'Dina Rahman', groups: ['account.manager'] };
|
|
3
|
+
export async function assetDemo(ctx) {
|
|
4
|
+
return ctx.as(DINA, async (raw) => {
|
|
5
|
+
const env = raw;
|
|
6
|
+
const byCode = async (code) => (await env.model('account.account').search({ where: { code }, limit: 1 })).ids[0];
|
|
7
|
+
const [asset, accumulated, expense] = [
|
|
8
|
+
await byCode('1500'),
|
|
9
|
+
await byCode('1590'),
|
|
10
|
+
await byCode('6600'),
|
|
11
|
+
];
|
|
12
|
+
const journal = (await env.model('account.journal').search({ where: { type: 'general' }, limit: 1 })).ids[0];
|
|
13
|
+
if (asset === undefined ||
|
|
14
|
+
accumulated === undefined ||
|
|
15
|
+
expense === undefined ||
|
|
16
|
+
journal === undefined)
|
|
17
|
+
return 'Fixed assets: no chart of accounts, nothing made.';
|
|
18
|
+
const accounts = {
|
|
19
|
+
assetAccount: asset,
|
|
20
|
+
accumulatedAccount: accumulated,
|
|
21
|
+
expenseAccount: expense,
|
|
22
|
+
journal,
|
|
23
|
+
};
|
|
24
|
+
const made = await env.model('account.asset.category').create([
|
|
25
|
+
{ name: 'Office equipment', ...accounts, method: 'linear', lifeMonths: 60, taxRate: '10' },
|
|
26
|
+
{ name: 'Computers', ...accounts, method: 'linear', lifeMonths: 36, taxRate: '30' },
|
|
27
|
+
{
|
|
28
|
+
name: 'Vehicles',
|
|
29
|
+
...accounts,
|
|
30
|
+
method: 'degressive',
|
|
31
|
+
lifeMonths: 60,
|
|
32
|
+
rate: '30',
|
|
33
|
+
taxRate: '20',
|
|
34
|
+
},
|
|
35
|
+
]);
|
|
36
|
+
const [, computers, vehicles] = made.ids;
|
|
37
|
+
const assets = await env.model('account.asset').create([
|
|
38
|
+
{
|
|
39
|
+
name: 'Laptops for the sales team (5)',
|
|
40
|
+
code: 'FA-0001',
|
|
41
|
+
category: computers,
|
|
42
|
+
value: '450000',
|
|
43
|
+
salvage: '0',
|
|
44
|
+
dateAcquired: ctx.date(-425),
|
|
45
|
+
dateInUse: ctx.date(-420),
|
|
46
|
+
method: 'linear',
|
|
47
|
+
lifeMonths: 36,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Delivery van',
|
|
51
|
+
code: 'FA-0002',
|
|
52
|
+
category: vehicles,
|
|
53
|
+
value: '3200000',
|
|
54
|
+
salvage: '400000',
|
|
55
|
+
dateAcquired: ctx.date(-200),
|
|
56
|
+
dateInUse: ctx.date(-200),
|
|
57
|
+
method: 'degressive',
|
|
58
|
+
rate: '30',
|
|
59
|
+
lifeMonths: 60,
|
|
60
|
+
},
|
|
61
|
+
]);
|
|
62
|
+
await env.flush();
|
|
63
|
+
await env.model('account.asset').browse(assets.ids).confirm();
|
|
64
|
+
await env.flush();
|
|
65
|
+
const posted = await env.asSuperuser({ reason: 'demo depreciation' }, async (su) => {
|
|
66
|
+
const n = await postDue(su, ctx.date(0));
|
|
67
|
+
await su.flush();
|
|
68
|
+
return n;
|
|
69
|
+
});
|
|
70
|
+
return `Fixed assets: 3 categories, 2 assets, ${posted} months of depreciation posted.`;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineModule } from '../modules-sdk/index.js';
|
|
2
|
+
import { type ModuleContext } from '../server/index.js';
|
|
3
|
+
import { type Worker } from '../server/orm.js';
|
|
4
|
+
export { board, taxBook, unitsLine } from './board.js';
|
|
5
|
+
export { assetsFromBill, dispose, planBoard, postDue, revalue, type TaxBookRow, taxBookOf, } from './books.js';
|
|
6
|
+
export { Asset, AssetCategory, AssetLine, AssetUsage, accountAssetShutro } from './module.js';
|
|
7
|
+
/** The subscriber that makes draft assets of posted bills; tests `drain()` it, the server starts it. */
|
|
8
|
+
export declare function assetWorker(context: Pick<ModuleContext, 'shutro'>): Worker;
|
|
9
|
+
export declare const accountAsset: ReturnType<typeof defineModule>;
|