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,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The data layer of Sign (RFC 0024 §2.8): templates — a PDF with fields for each signer's role (signature, initials,
|
|
3
|
+
* date, text, checkbox), placed on a page as fractions of its width and height —; requests made from a template,
|
|
4
|
+
* often from a record (a quotation, a contract), with their signers in order or all at once; and each signer's link
|
|
5
|
+
* and one-time code (only hashes kept), what they filled in, when and from where. Once the last signer is done the
|
|
6
|
+
* PDF is sealed — the values stamped in, a certificate page added, its hash before and after kept — and stored.
|
|
7
|
+
*/
|
|
8
|
+
import { contactsShutro } from '../contacts/index.js';
|
|
9
|
+
import { documentsShutro } from '../documents/index.js';
|
|
10
|
+
import { messagingShutro } from '../messaging/index.js';
|
|
11
|
+
import { orm } from '../server/orm.js';
|
|
12
|
+
import { check, defineModel, defineModule, f, records } from './.kosh/bindings.js';
|
|
13
|
+
import { beforeSend } from './sign.js';
|
|
14
|
+
const ALL = ['read', 'write', 'create', 'unlink'];
|
|
15
|
+
export const FIELD_KINDS = {
|
|
16
|
+
signature: 'Signature',
|
|
17
|
+
initials: 'Initials',
|
|
18
|
+
date: 'Date signed',
|
|
19
|
+
text: 'Text',
|
|
20
|
+
checkbox: 'Checkbox',
|
|
21
|
+
};
|
|
22
|
+
export const SignTemplate = defineModel('sign.template', {
|
|
23
|
+
label: 'Signing template',
|
|
24
|
+
recName: 'name',
|
|
25
|
+
order: ['name asc'],
|
|
26
|
+
archivable: true,
|
|
27
|
+
companyScoped: { required: true },
|
|
28
|
+
tracking: ['name', 'attachment'],
|
|
29
|
+
access: { 'sign.user': ['read'], 'sign.manager': [...ALL, 'export'] },
|
|
30
|
+
fields: {
|
|
31
|
+
name: f.char({ required: true }),
|
|
32
|
+
/** The PDF (an attachment of the template). */
|
|
33
|
+
attachment: f.many2one('storage.attachment', { ondelete: 'set null', label: 'PDF' }),
|
|
34
|
+
pages: f.integer({ label: 'Pages' }),
|
|
35
|
+
fields: f.one2many('sign.template.field', 'template', { label: 'Fields' }),
|
|
36
|
+
description: f.text(),
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
export const SignTemplateField = defineModel('sign.template.field', {
|
|
40
|
+
label: 'Signing field',
|
|
41
|
+
order: ['page asc', 'y asc', 'x asc', 'id asc'],
|
|
42
|
+
access: { 'sign.user': ['read'], 'sign.manager': ALL },
|
|
43
|
+
fields: {
|
|
44
|
+
template: f.many2one('sign.template', { required: true, ondelete: 'cascade' }),
|
|
45
|
+
/** Whose it is: "Customer", "Company". */
|
|
46
|
+
role: f.char({ required: true }),
|
|
47
|
+
kind: f.selection(FIELD_KINDS, { required: true, default: 'signature' }),
|
|
48
|
+
label: f.char(),
|
|
49
|
+
page: f.integer({ required: true, default: 1 }),
|
|
50
|
+
/** From the page's top-left corner, as fractions of its width and height (0 to 1). */
|
|
51
|
+
x: f.decimal({ scale: 4, required: true, default: '0.1' }),
|
|
52
|
+
y: f.decimal({ scale: 4, required: true, default: '0.8' }),
|
|
53
|
+
width: f.decimal({ scale: 4, required: true, default: '0.3' }),
|
|
54
|
+
height: f.decimal({ scale: 4, required: true, default: '0.06' }),
|
|
55
|
+
required: f.boolean({ default: true }),
|
|
56
|
+
},
|
|
57
|
+
sqlConstraints: {
|
|
58
|
+
placed: {
|
|
59
|
+
check: orm.sql `page >= 1 AND x >= 0 AND y >= 0 AND width > 0 AND height > 0 AND x + width <= 1 AND y + height <= 1`,
|
|
60
|
+
message: 'A field is on a page, inside it.',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
export const SignRequest = defineModel('sign.request', {
|
|
65
|
+
label: 'Signing request',
|
|
66
|
+
recName: 'name',
|
|
67
|
+
order: ['id desc'],
|
|
68
|
+
companyScoped: { required: true },
|
|
69
|
+
tracking: ['state'],
|
|
70
|
+
access: { 'sign.user': ['read', 'write', 'create'], 'sign.manager': [...ALL, 'export'] },
|
|
71
|
+
fields: {
|
|
72
|
+
name: f.char({ required: true }),
|
|
73
|
+
template: f.many2one('sign.template', { required: true, ondelete: 'restrict' }),
|
|
74
|
+
/** The record it is signed from (its signed PDF is attached to it). */
|
|
75
|
+
resModel: f.char({ label: 'For (model)' }),
|
|
76
|
+
resId: f.integer({ label: 'For (record)' }),
|
|
77
|
+
ordered: f.boolean({ default: true, label: 'Signers in order' }),
|
|
78
|
+
signers: f.one2many('sign.signer', 'request'),
|
|
79
|
+
message: f.text(),
|
|
80
|
+
/** The SHA-256 of the template's PDF when the request was sent, and of the sealed one. */
|
|
81
|
+
hashBefore: f.char({ label: 'Hash before' }),
|
|
82
|
+
hashAfter: f.char({ label: 'Hash after' }),
|
|
83
|
+
sealed: f.many2one('storage.attachment', { ondelete: 'set null', label: 'Signed PDF' }),
|
|
84
|
+
document: f.many2one('documents.document', { ondelete: 'set null', label: 'Document' }),
|
|
85
|
+
completedAt: f.datetime({ label: 'Completed at' }),
|
|
86
|
+
refusal: f.text({ label: 'Why it was refused' }),
|
|
87
|
+
state: f.state({
|
|
88
|
+
states: {
|
|
89
|
+
draft: 'Draft',
|
|
90
|
+
sent: 'Out for signature',
|
|
91
|
+
signed: 'Signed',
|
|
92
|
+
refused: 'Refused',
|
|
93
|
+
cancel: 'Cancelled',
|
|
94
|
+
},
|
|
95
|
+
initial: 'draft',
|
|
96
|
+
transitions: {
|
|
97
|
+
/** Checks the template and asks the signers (the first in order, or all). */
|
|
98
|
+
send: {
|
|
99
|
+
from: ['draft'],
|
|
100
|
+
to: 'sent',
|
|
101
|
+
before: records('sign.request', async (requests) => {
|
|
102
|
+
await beforeSend(requests.env, requests.ids);
|
|
103
|
+
}),
|
|
104
|
+
},
|
|
105
|
+
complete: {
|
|
106
|
+
from: ['sent'],
|
|
107
|
+
to: 'signed',
|
|
108
|
+
after: records('sign.request', async (requests) => {
|
|
109
|
+
for (const id of requests.ids)
|
|
110
|
+
await requests.env.emit('sign.request.signed', { id });
|
|
111
|
+
}),
|
|
112
|
+
},
|
|
113
|
+
refuse: { from: ['sent'], to: 'refused' },
|
|
114
|
+
cancel: { from: ['draft', 'sent'], to: 'cancel' },
|
|
115
|
+
},
|
|
116
|
+
}),
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
export const SignSigner = defineModel('sign.signer', {
|
|
120
|
+
label: 'Signer',
|
|
121
|
+
order: ['sequence asc', 'id asc'],
|
|
122
|
+
access: { 'sign.user': ['read', 'write', 'create'], 'sign.manager': ALL },
|
|
123
|
+
fields: {
|
|
124
|
+
request: f.many2one('sign.request', { required: true, ondelete: 'cascade' }),
|
|
125
|
+
role: f.char({ required: true }),
|
|
126
|
+
name: f.char({ required: true }),
|
|
127
|
+
email: f.char({ required: true }),
|
|
128
|
+
partner: f.many2one('res.partner', { ondelete: 'set null' }),
|
|
129
|
+
sequence: f.integer({ required: true, default: 10 }),
|
|
130
|
+
state: f.selection({ waiting: 'Waiting', sent: 'Asked', signed: 'Signed', refused: 'Refused' }, { required: true, default: 'waiting' }),
|
|
131
|
+
tokenHash: f.char({ index: true, label: 'Link (hash)' }),
|
|
132
|
+
codeHash: f.char({ label: 'Code (hash)' }),
|
|
133
|
+
codeExpiresAt: f.datetime({ label: 'Code expires' }),
|
|
134
|
+
codeAttempts: f.integer({ required: true, default: 0 }),
|
|
135
|
+
/** What they filled in, by field id (a signature as a PNG data URL). */
|
|
136
|
+
values: f.json({ label: 'Values' }),
|
|
137
|
+
sentAt: f.datetime({ label: 'Asked at' }),
|
|
138
|
+
signedAt: f.datetime({ label: 'Signed at' }),
|
|
139
|
+
ip: f.char({ label: 'IP address' }),
|
|
140
|
+
userAgent: f.char({ label: 'Browser' }),
|
|
141
|
+
},
|
|
142
|
+
constraints: {
|
|
143
|
+
email: {
|
|
144
|
+
...check('sign.signer', ['email'], async (signers) => signers.filter((s) => !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.email)).map((s) => s.id)),
|
|
145
|
+
message: 'A signer has an email address.',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
export const signShutro = defineModule({
|
|
150
|
+
name: 'sign',
|
|
151
|
+
version: '0.1.0',
|
|
152
|
+
depends: [contactsShutro, messagingShutro, documentsShutro],
|
|
153
|
+
groups: [
|
|
154
|
+
orm.defineGroup({ code: 'sign.user', label: 'Sign user', implies: ['contacts.user'] }),
|
|
155
|
+
orm.defineGroup({ code: 'sign.manager', label: 'Sign manager', implies: ['sign.user'] }),
|
|
156
|
+
],
|
|
157
|
+
models: [SignTemplate, SignTemplateField, SignRequest, SignSigner],
|
|
158
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type Mailer } from '../mail/index.js';
|
|
2
|
+
import { type Storage } from '../storage/index.js';
|
|
3
|
+
import type { Env } from './.kosh/bindings.js';
|
|
4
|
+
export declare const sha256: (bytes: Uint8Array) => string;
|
|
5
|
+
declare let config: {
|
|
6
|
+
mailer: Mailer | undefined;
|
|
7
|
+
apiUrl: string;
|
|
8
|
+
/** The file store, asked for when a PDF is read or written (a server may have none). */
|
|
9
|
+
storage: (() => Storage) | null;
|
|
10
|
+
};
|
|
11
|
+
export declare function configureSign(next: Partial<typeof config>): void;
|
|
12
|
+
/** A template's PDF, as bytes. */
|
|
13
|
+
export declare function templatePdf(env: Env, template: number): Promise<Uint8Array>;
|
|
14
|
+
/** Stores a PDF as the template's (as the system, the template read by the caller): its page count follows. */
|
|
15
|
+
export declare function setTemplatePdf(env: Env, template: number, file: {
|
|
16
|
+
name: string;
|
|
17
|
+
data: Uint8Array;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
pages: number;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* As requests are sent: the template has its PDF and a signer for every role of its fields; the PDF's hash is
|
|
23
|
+
* kept; the first signer (in order) or all of them are asked.
|
|
24
|
+
*/
|
|
25
|
+
export declare function beforeSend(env: Env, ids: readonly number[]): Promise<void>;
|
|
26
|
+
/** The signer a link belongs to, while they are asked and the request is out for signature. */
|
|
27
|
+
export declare function signerOf(env: Env, token: string): Promise<{
|
|
28
|
+
id: number;
|
|
29
|
+
name: string;
|
|
30
|
+
role: string;
|
|
31
|
+
request: {
|
|
32
|
+
id: number;
|
|
33
|
+
name: string;
|
|
34
|
+
company: string;
|
|
35
|
+
message: string | null;
|
|
36
|
+
};
|
|
37
|
+
fields: {
|
|
38
|
+
id: number;
|
|
39
|
+
kind: string;
|
|
40
|
+
label: string | null;
|
|
41
|
+
page: number;
|
|
42
|
+
required: boolean;
|
|
43
|
+
}[];
|
|
44
|
+
} | null>;
|
|
45
|
+
/** A one-time code by email to the link's signer (a new one replaces the last). */
|
|
46
|
+
export declare function sendCode(env: Env, token: string): Promise<void>;
|
|
47
|
+
/** A wrong or expired code: counted (the count commits), then answered with 401 by the route. */
|
|
48
|
+
export declare class WrongCode extends Error {
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Signs for the link's signer with their code: their values kept with when and from where; the next signer asked
|
|
52
|
+
* (in order), or — the last — the PDF sealed and the request completed.
|
|
53
|
+
*/
|
|
54
|
+
export declare function signWith(env: Env, token: string, input: {
|
|
55
|
+
code: string;
|
|
56
|
+
values: Record<string, unknown>;
|
|
57
|
+
ip: string;
|
|
58
|
+
userAgent: string;
|
|
59
|
+
}): Promise<{
|
|
60
|
+
completed: boolean;
|
|
61
|
+
}>;
|
|
62
|
+
/** Refuses for the link's signer, with their code and why: the request is refused, the others told. */
|
|
63
|
+
export declare function refuseWith(env: Env, token: string, input: {
|
|
64
|
+
code: string;
|
|
65
|
+
reason: string;
|
|
66
|
+
}): Promise<void>;
|
|
67
|
+
/** Makes a request from a template for a record (or none), with its signers; a draft, to send. */
|
|
68
|
+
export declare function requestFrom(env: Env, input: {
|
|
69
|
+
template: number;
|
|
70
|
+
name?: string;
|
|
71
|
+
model?: string;
|
|
72
|
+
id?: number;
|
|
73
|
+
ordered?: boolean;
|
|
74
|
+
message?: string;
|
|
75
|
+
signers: {
|
|
76
|
+
role: string;
|
|
77
|
+
name: string;
|
|
78
|
+
email: string;
|
|
79
|
+
partner?: number;
|
|
80
|
+
}[];
|
|
81
|
+
}): Promise<number>;
|
|
82
|
+
export {};
|