shutro-erp 0.3.5 → 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 +123 -4
- package/dist/account_portal/module.d.ts +146 -0
- package/dist/accounting/.kosh/bindings.js +1 -1
- package/dist/accounting/.kosh/schema.d.ts +123 -4
- package/dist/accounting/index.d.ts +1 -1
- package/dist/accounting/index.js +131 -3
- package/dist/accounting/module.d.ts +296 -0
- package/dist/accounting/module.js +32 -1
- 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/cli/init.js +32 -0
- package/dist/cli/templates.d.ts +1 -1
- package/dist/cli/templates.js +89 -0
- package/dist/contacts/module.js +13 -2
- package/dist/crm/.kosh/bindings.js +1 -1
- package/dist/crm/.kosh/schema.d.ts +2 -1
- package/dist/crm/module.d.ts +2 -0
- package/dist/crm/module.js +2 -1
- 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_account/.kosh/bindings.js +1 -1
- package/dist/event_account/.kosh/schema.d.ts +123 -4
- package/dist/event_account/module.d.ts +146 -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/index.d.ts +1 -1
- package/dist/hr/index.js +1 -1
- package/dist/l10n_bd/.kosh/bindings.js +1 -1
- package/dist/l10n_bd/.kosh/schema.d.ts +123 -4
- package/dist/l10n_bd/module.d.ts +146 -0
- 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 +123 -4
- package/dist/l10n_in/module.d.ts +147 -0
- package/dist/mail/inbound/handle.js +6 -1
- package/dist/maintenance_stock/.kosh/bindings.js +1 -1
- package/dist/maintenance_stock/.kosh/schema.d.ts +77 -2
- package/dist/maintenance_stock/module.d.ts +788 -66
- package/dist/modules-sdk/index.d.ts +1 -1
- package/dist/modules-sdk/manifest.d.ts +39 -2
- package/dist/mrp/.kosh/bindings.js +1 -1
- package/dist/mrp/.kosh/schema.d.ts +77 -2
- package/dist/mrp/index.d.ts +1 -1
- package/dist/mrp/index.js +2 -1
- package/dist/mrp/module.d.ts +781 -54
- package/dist/mrp/module.js +64 -2
- package/dist/mrp_account/.kosh/bindings.js +1 -1
- package/dist/mrp_account/.kosh/schema.d.ts +198 -5
- package/dist/mrp_account/module.d.ts +4852 -2541
- package/dist/payment/.kosh/bindings.js +1 -1
- package/dist/payment/.kosh/schema.d.ts +125 -5
- package/dist/payment/index.d.ts +41 -0
- package/dist/payment/index.js +131 -74
- package/dist/payment/module.d.ts +210 -6
- 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/index.js +1 -1
- package/dist/pos/.kosh/bindings.js +1 -1
- package/dist/pos/.kosh/schema.d.ts +123 -4
- package/dist/pos/index.js +4 -0
- package/dist/pos/module.d.ts +147 -0
- package/dist/pos_stock/.kosh/bindings.js +1 -1
- package/dist/pos_stock/.kosh/schema.d.ts +198 -5
- package/dist/pos_stock/module.d.ts +914 -46
- package/dist/product/.kosh/bindings.js +1 -1
- package/dist/product/.kosh/schema.d.ts +2 -1
- package/dist/product/index.js +13 -0
- package/dist/product/module.d.ts +2 -0
- package/dist/product/module.js +2 -1
- package/dist/project/.kosh/bindings.js +1 -1
- package/dist/project/.kosh/schema.d.ts +672 -1
- package/dist/project/index.d.ts +3 -1
- package/dist/project/index.js +901 -14
- package/dist/project/module.d.ts +9892 -390
- package/dist/project/module.js +1530 -13
- 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 +672 -1
- package/dist/project_portal/module.d.ts +4798 -129
- 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 +97 -4
- package/dist/purchase/module.d.ts +13 -2
- package/dist/purchase/module.js +10 -1
- package/dist/purchase_account/.kosh/bindings.js +1 -1
- package/dist/purchase_account/.kosh/schema.d.ts +126 -6
- package/dist/purchase_account/index.js +1 -0
- package/dist/purchase_account/module.d.ts +176 -1
- 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 +97 -4
- package/dist/purchase_portal/module.d.ts +6 -1
- package/dist/purchase_stock/.kosh/bindings.js +1 -1
- package/dist/purchase_stock/.kosh/schema.d.ts +174 -5
- package/dist/purchase_stock/index.d.ts +1 -1
- package/dist/purchase_stock/index.js +9 -2
- package/dist/purchase_stock/module.d.ts +840 -68
- package/dist/purchase_stock/module.js +242 -6
- package/dist/purchase_stock_account/.kosh/bindings.js +1 -1
- package/dist/purchase_stock_account/.kosh/schema.d.ts +203 -7
- package/dist/purchase_stock_account/module.d.ts +8163 -5514
- package/dist/purchase_stock_account/module.js +11 -5
- package/dist/recruitment/.kosh/bindings.js +1 -1
- package/dist/recruitment/.kosh/schema.d.ts +2 -1
- package/dist/recruitment/module.d.ts +2 -0
- package/dist/recruitment/module.js +2 -1
- package/dist/sale_account/.kosh/bindings.js +1 -1
- package/dist/sale_account/.kosh/schema.d.ts +123 -4
- package/dist/sale_account/module.d.ts +147 -0
- package/dist/sale_portal/.kosh/bindings.js +1 -1
- package/dist/sale_portal/.kosh/schema.d.ts +2 -1
- package/dist/sale_portal/module.d.ts +1 -0
- package/dist/sale_project/.kosh/bindings.js +1 -1
- package/dist/sale_project/.kosh/schema.d.ts +673 -1
- package/dist/sale_project/module.d.ts +4800 -129
- package/dist/sale_project/module.js +17 -1
- package/dist/sale_stock/.kosh/bindings.js +1 -1
- package/dist/sale_stock/.kosh/schema.d.ts +77 -2
- package/dist/sale_stock/module.d.ts +789 -66
- package/dist/sales/.kosh/bindings.js +1 -1
- package/dist/sales/.kosh/schema.d.ts +2 -1
- package/dist/sales/index.js +4 -0
- package/dist/sales/module.d.ts +1 -0
- 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.js +1 -1
- package/dist/stock/.kosh/schema.d.ts +77 -2
- package/dist/stock/demo.d.ts +2 -1
- package/dist/stock/demo.js +28 -1
- package/dist/stock/index.d.ts +2 -1
- package/dist/stock/index.js +233 -4
- package/dist/stock/module.d.ts +2363 -837
- package/dist/stock/module.js +569 -14
- 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/index.d.ts +4 -2
- package/dist/stock/web/index.js +6 -2
- package/dist/stock/web/messages.js +52 -0
- package/dist/stock_account/.kosh/bindings.js +1 -1
- package/dist/stock_account/.kosh/schema.d.ts +198 -5
- package/dist/stock_account/index.js +10 -0
- package/dist/stock_account/module.d.ts +969 -101
- package/dist/trade_finance/index.js +2 -0
- package/dist/trade_finance/module.js +2 -0
- package/dist/trade_finance_account/.kosh/bindings.js +1 -1
- package/dist/trade_finance_account/.kosh/schema.d.ts +123 -4
- package/dist/trade_finance_account/index.js +1 -0
- package/dist/trade_finance_account/module.d.ts +146 -0
- package/dist/trade_finance_account/module.js +1 -0
- package/dist/trade_finance_purchase/.kosh/bindings.js +1 -1
- package/dist/trade_finance_purchase/.kosh/schema.d.ts +97 -4
- package/dist/trade_finance_purchase/module.d.ts +6 -1
- package/dist/trade_finance_sale/.kosh/bindings.js +1 -1
- package/dist/trade_finance_sale/.kosh/schema.d.ts +2 -1
- package/dist/trade_finance_sale/module.d.ts +1 -0
- package/dist/ui/app.js +24 -12
- package/dist/ui/components/AppIcon.js +8 -1
- package/dist/ui/i18n/messages.d.ts +4 -0
- package/dist/ui/i18n/messages.js +8 -0
- package/dist/ui/views/FormView.js +4 -2
- package/dist/ui/views/KanbanView.js +9 -1
- package/dist/ui/views/ListView.js +4 -2
- package/dist/ui/views/widgets.js +7 -1
- package/dist/website/index.js +1 -0
- package/dist/website/module.js +1 -0
- package/dist/website_crm/.kosh/bindings.js +1 -1
- package/dist/website_crm/.kosh/schema.d.ts +2 -1
- package/dist/website_crm/module.d.ts +1 -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 +83 -2
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The data layer of fixed assets (RFC 0024 §2.5): **categories** (the accounts, the journal, the method and life,
|
|
3
|
+
* the tax book's rate), **assets** (from a posted bill's line on a category's asset account, or by hand) with their
|
|
4
|
+
* **board** of month-end depreciation lines — each posted once — and, for units of production, the **usage** of each
|
|
5
|
+
* month. A running asset is disposed of or sold with its gain or loss, revalued or impaired (the rest of its board
|
|
6
|
+
* planned again); a fully depreciated one closes.
|
|
7
|
+
*/
|
|
8
|
+
import { accountingShutro } from '../accounting/index.js';
|
|
9
|
+
import { orm } from '../server/orm.js';
|
|
10
|
+
import { check, compute, defineModel, defineModule, f, records, } from './.kosh/bindings.js';
|
|
11
|
+
const READ = ['read'];
|
|
12
|
+
const ALL = ['read', 'write', 'create', 'unlink', 'export', 'import'];
|
|
13
|
+
const ZERO = orm.toDecimal(0);
|
|
14
|
+
const METHODS = {
|
|
15
|
+
linear: 'Straight line',
|
|
16
|
+
degressive: 'Declining balance',
|
|
17
|
+
units: 'Units of production',
|
|
18
|
+
};
|
|
19
|
+
export const AssetCategory = defineModel('account.asset.category', {
|
|
20
|
+
label: 'Asset category',
|
|
21
|
+
recName: 'name',
|
|
22
|
+
order: ['name asc'],
|
|
23
|
+
archivable: true,
|
|
24
|
+
companyScoped: { required: true },
|
|
25
|
+
access: { 'account.user': READ, 'account.manager': ALL },
|
|
26
|
+
fields: {
|
|
27
|
+
name: f.char({ required: true, translate: true }),
|
|
28
|
+
assetAccount: f.many2one('account.account', {
|
|
29
|
+
required: true,
|
|
30
|
+
ondelete: 'restrict',
|
|
31
|
+
label: 'Asset account',
|
|
32
|
+
help: 'A bill line on this account makes a draft asset of this category.',
|
|
33
|
+
}),
|
|
34
|
+
accumulatedAccount: f.many2one('account.account', {
|
|
35
|
+
required: true,
|
|
36
|
+
ondelete: 'restrict',
|
|
37
|
+
label: 'Accumulated depreciation',
|
|
38
|
+
}),
|
|
39
|
+
expenseAccount: f.many2one('account.account', {
|
|
40
|
+
required: true,
|
|
41
|
+
ondelete: 'restrict',
|
|
42
|
+
label: 'Depreciation expense',
|
|
43
|
+
}),
|
|
44
|
+
gainAccount: f.many2one('account.account', { ondelete: 'restrict', label: 'Gain on disposal' }),
|
|
45
|
+
lossAccount: f.many2one('account.account', {
|
|
46
|
+
ondelete: 'restrict',
|
|
47
|
+
label: 'Loss on disposal or impairment',
|
|
48
|
+
}),
|
|
49
|
+
journal: f.many2one('account.journal', { required: true, ondelete: 'restrict' }),
|
|
50
|
+
method: f.selection(METHODS, {
|
|
51
|
+
required: true,
|
|
52
|
+
default: 'linear',
|
|
53
|
+
help: 'Straight line over the life; declining balance at the rate, switching to straight line at the end; units of production by usage.',
|
|
54
|
+
}),
|
|
55
|
+
lifeMonths: f.integer({ required: true, default: 60, label: 'Life (months)' }),
|
|
56
|
+
rate: f.decimal({ scale: 2, default: '20', label: 'Declining rate (% a year)' }),
|
|
57
|
+
prorata: f.boolean({
|
|
58
|
+
default: true,
|
|
59
|
+
label: 'From the date of use',
|
|
60
|
+
help: 'The first month counts from the day the asset is put to use.',
|
|
61
|
+
}),
|
|
62
|
+
taxRate: f.decimal({
|
|
63
|
+
scale: 2,
|
|
64
|
+
label: 'Tax depreciation (% a year)',
|
|
65
|
+
help: 'The tax book: reducing balance at this rate (Bangladesh: the Third Schedule of the Income Tax Act — verify for the year).',
|
|
66
|
+
}),
|
|
67
|
+
},
|
|
68
|
+
sqlConstraints: {
|
|
69
|
+
life: { check: orm.sql `life_months > 0`, message: 'An asset’s life is at least a month.' },
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
const STATES = {
|
|
73
|
+
draft: 'Draft',
|
|
74
|
+
running: 'Running',
|
|
75
|
+
disposed: 'Disposed',
|
|
76
|
+
closed: 'Fully depreciated',
|
|
77
|
+
};
|
|
78
|
+
export const Asset = defineModel('account.asset', {
|
|
79
|
+
label: 'Fixed asset',
|
|
80
|
+
recName: 'name',
|
|
81
|
+
order: ['dateInUse desc', 'id desc'],
|
|
82
|
+
companyScoped: { required: true },
|
|
83
|
+
tracking: ['state', 'value', 'salvage', 'method', 'lifeMonths'],
|
|
84
|
+
access: { 'account.user': READ, 'account.manager': ALL },
|
|
85
|
+
fields: {
|
|
86
|
+
name: f.char({ required: true }),
|
|
87
|
+
code: f.char({ size: 64, label: 'Tag', help: 'The tag on the asset, scanned in counts.' }),
|
|
88
|
+
category: f.many2one('account.asset.category', { required: true, ondelete: 'restrict' }),
|
|
89
|
+
partner: f.many2one('res.partner', { ondelete: 'set null', label: 'Vendor' }),
|
|
90
|
+
bill: f.many2one('account.move', { ondelete: 'set null', label: 'From bill' }),
|
|
91
|
+
billLine: f.many2one('account.move.line', { ondelete: 'set null', label: 'From bill line' }),
|
|
92
|
+
analytic: f.many2one('account.analytic', { ondelete: 'set null', label: 'Cost centre' }),
|
|
93
|
+
value: f.decimal({ scale: 2, required: true, label: 'Cost' }),
|
|
94
|
+
salvage: f.decimal({ scale: 2, required: true, default: '0', label: 'Salvage value' }),
|
|
95
|
+
dateAcquired: f.date({ required: true, label: 'Acquired' }),
|
|
96
|
+
dateInUse: f.date({ required: true, label: 'In use from' }),
|
|
97
|
+
method: f.selection(METHODS, {
|
|
98
|
+
required: true,
|
|
99
|
+
default: 'linear',
|
|
100
|
+
help: 'From the category; changeable while the asset is a draft.',
|
|
101
|
+
}),
|
|
102
|
+
lifeMonths: f.integer({ required: true, default: 60, label: 'Life (months)' }),
|
|
103
|
+
rate: f.decimal({ scale: 2, default: '20', label: 'Declining rate (% a year)' }),
|
|
104
|
+
prorata: f.boolean({ default: true, label: 'From the date of use' }),
|
|
105
|
+
totalUnits: f.decimal({
|
|
106
|
+
scale: 2,
|
|
107
|
+
label: 'Units over its life',
|
|
108
|
+
help: 'Units of production: hours, kilometres, pieces.',
|
|
109
|
+
}),
|
|
110
|
+
lines: f.one2many('account.asset.line', 'asset', { label: 'Board' }),
|
|
111
|
+
usage: f.one2many('account.asset.usage', 'asset'),
|
|
112
|
+
depreciated: f.decimal({
|
|
113
|
+
scale: 2,
|
|
114
|
+
label: 'Depreciated (posted)',
|
|
115
|
+
help: 'The posted depreciation, impairments included.',
|
|
116
|
+
...compute('account.asset', 'depreciated', ['lines.amount', 'lines.posted', 'lines.kind'], (assets) => {
|
|
117
|
+
for (const a of assets)
|
|
118
|
+
a.depreciated = [...a.lines]
|
|
119
|
+
.filter((l) => l.posted && (l.kind === 'depreciation' || l.kind === 'impairment'))
|
|
120
|
+
.reduce((s, l) => s.plus(l.amount), ZERO);
|
|
121
|
+
}),
|
|
122
|
+
store: true,
|
|
123
|
+
}),
|
|
124
|
+
bookValue: f.decimal({
|
|
125
|
+
scale: 2,
|
|
126
|
+
label: 'Book value',
|
|
127
|
+
help: 'The cost, revaluations included, less what was depreciated.',
|
|
128
|
+
...compute('account.asset', 'bookValue', ['value', 'depreciated', 'lines.amount', 'lines.kind', 'lines.posted'], (assets) => {
|
|
129
|
+
for (const a of assets) {
|
|
130
|
+
const revalued = [...a.lines]
|
|
131
|
+
.filter((l) => l.posted && l.kind === 'revaluation')
|
|
132
|
+
.reduce((s, l) => s.plus(l.amount), ZERO);
|
|
133
|
+
a.bookValue = a.value.plus(revalued).minus(a.depreciated ?? ZERO);
|
|
134
|
+
}
|
|
135
|
+
}),
|
|
136
|
+
store: true,
|
|
137
|
+
}),
|
|
138
|
+
disposedOn: f.date({ label: 'Disposed on' }),
|
|
139
|
+
proceeds: f.decimal({ scale: 2, label: 'Sold for' }),
|
|
140
|
+
state: f.state({
|
|
141
|
+
states: STATES,
|
|
142
|
+
initial: 'draft',
|
|
143
|
+
help: 'A running asset is depreciated month by month; disposing of it, or the last month, ends it.',
|
|
144
|
+
transitions: {
|
|
145
|
+
confirm: {
|
|
146
|
+
from: ['draft'],
|
|
147
|
+
to: 'running',
|
|
148
|
+
after: records('account.asset', async (assets) => {
|
|
149
|
+
const env = assets.env;
|
|
150
|
+
await env.flush();
|
|
151
|
+
const { planBoard } = await import('./books.js');
|
|
152
|
+
await env.asSuperuser({ reason: 'asset board' }, async (su) => {
|
|
153
|
+
await planBoard(su, assets.ids);
|
|
154
|
+
await su.flush();
|
|
155
|
+
});
|
|
156
|
+
}),
|
|
157
|
+
},
|
|
158
|
+
dispose: { from: ['running'], to: 'disposed' },
|
|
159
|
+
close: { from: ['running'], to: 'closed' },
|
|
160
|
+
},
|
|
161
|
+
}),
|
|
162
|
+
},
|
|
163
|
+
sqlConstraints: {
|
|
164
|
+
amounts: {
|
|
165
|
+
check: orm.sql `value > 0 AND salvage >= 0 AND salvage < value AND life_months > 0`,
|
|
166
|
+
message: 'The cost is positive, the salvage value below it, the life at least a month.',
|
|
167
|
+
},
|
|
168
|
+
dates: {
|
|
169
|
+
check: orm.sql `date_in_use >= date_acquired`,
|
|
170
|
+
message: 'An asset is used after it is acquired.',
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
constraints: {
|
|
174
|
+
units: {
|
|
175
|
+
...check('account.asset', ['method', 'totalUnits'], (assets) => [...assets]
|
|
176
|
+
.filter((a) => a.method === 'units' && (a.totalUnits === null || a.totalUnits.lte(0)))
|
|
177
|
+
.map((a) => a.id)),
|
|
178
|
+
message: 'Units of production need the units over the asset’s life.',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
export const AssetLine = defineModel('account.asset.line', {
|
|
183
|
+
label: 'Depreciation line',
|
|
184
|
+
order: ['date asc', 'id asc'],
|
|
185
|
+
access: { 'account.user': READ, 'account.manager': ALL },
|
|
186
|
+
fields: {
|
|
187
|
+
asset: f.many2one('account.asset', { required: true, ondelete: 'cascade' }),
|
|
188
|
+
date: f.date({ required: true }),
|
|
189
|
+
kind: f.selection({
|
|
190
|
+
depreciation: 'Depreciation',
|
|
191
|
+
impairment: 'Impairment',
|
|
192
|
+
revaluation: 'Revaluation',
|
|
193
|
+
disposal: 'Disposal',
|
|
194
|
+
}, {
|
|
195
|
+
required: true,
|
|
196
|
+
default: 'depreciation',
|
|
197
|
+
help: 'Depreciation and impairment lower the book value; a revaluation raises it.',
|
|
198
|
+
}),
|
|
199
|
+
amount: f.decimal({ scale: 2, required: true }),
|
|
200
|
+
posted: f.boolean({ default: false }),
|
|
201
|
+
move: f.many2one('account.move', { ondelete: 'restrict', label: 'Journal entry' }),
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
export const AssetUsage = defineModel('account.asset.usage', {
|
|
205
|
+
label: 'Asset usage',
|
|
206
|
+
order: ['date asc', 'id asc'],
|
|
207
|
+
access: { 'account.user': READ, 'account.manager': ALL },
|
|
208
|
+
fields: {
|
|
209
|
+
asset: f.many2one('account.asset', { required: true, ondelete: 'cascade' }),
|
|
210
|
+
date: f.date({ required: true, help: 'The month it was used in (its last day).' }),
|
|
211
|
+
units: f.decimal({ scale: 2, required: true }),
|
|
212
|
+
line: f.many2one('account.asset.line', { ondelete: 'set null', label: 'Depreciated by' }),
|
|
213
|
+
},
|
|
214
|
+
sqlConstraints: {
|
|
215
|
+
positive: { check: orm.sql `units > 0`, message: 'Usage is positive.' },
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
export const accountAssetShutro = defineModule({
|
|
219
|
+
name: 'account_asset',
|
|
220
|
+
version: '0.1.0',
|
|
221
|
+
depends: [accountingShutro],
|
|
222
|
+
groups: [
|
|
223
|
+
orm.defineGroup({
|
|
224
|
+
code: 'account_asset.user',
|
|
225
|
+
label: 'Fixed assets',
|
|
226
|
+
implies: ['account.user'],
|
|
227
|
+
}),
|
|
228
|
+
],
|
|
229
|
+
models: [AssetCategory, Asset, AssetLine, AssetUsage],
|
|
230
|
+
});
|
|
@@ -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: a97150174a5194e7
|
|
2
|
+
// Bindings of module `account_budget`: 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;
|