@tailor-platform/erp-kit 0.4.0 → 0.5.0
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/CHANGELOG.md +36 -0
- package/README.md +12 -12
- package/dist/cli.mjs +476 -29
- package/package.json +2 -11
- package/skills/erp-kit-app-1-requirements/SKILL.md +31 -3
- package/skills/{erp-kit-app-3-plan → erp-kit-app-1-requirements}/references/story-extraction.md +3 -9
- package/skills/erp-kit-app-2-requirements-review/SKILL.md +31 -7
- package/skills/erp-kit-app-2-requirements-review/references/best-practices-check.md +1 -1
- package/skills/erp-kit-app-2-requirements-review/references/story-quality-check.md +67 -0
- package/skills/erp-kit-app-3-plan/SKILL.md +33 -32
- package/skills/erp-kit-app-3-plan/references/resolver-extraction.md +10 -5
- package/skills/erp-kit-app-3-plan/references/screen-extraction.md +5 -3
- package/skills/erp-kit-app-4-plan-review/SKILL.md +19 -14
- package/skills/erp-kit-app-4-plan-review/references/orphan-detection.md +3 -0
- package/skills/erp-kit-app-4-plan-review/references/story-resolver-parity.md +21 -3
- package/skills/erp-kit-app-5-impl-backend/SKILL.md +22 -3
- package/skills/erp-kit-app-6-impl-frontend/SKILL.md +19 -4
- package/skills/erp-kit-app-7-impl-review/SKILL.md +19 -15
- package/skills/erp-kit-app-shared/references/resolver-classification.md +3 -0
- package/skills/erp-kit-module-2-requirements-review/SKILL.md +17 -36
- package/skills/erp-kit-module-3-update-plan/SKILL.md +132 -0
- package/skills/erp-kit-module-3-update-plan/references/command-extraction.md +87 -0
- package/skills/erp-kit-module-3-update-plan/references/model-extraction.md +72 -0
- package/skills/erp-kit-module-3-update-plan/references/naming.md +73 -0
- package/skills/erp-kit-module-3-update-plan/references/query-extraction.md +59 -0
- package/skills/erp-kit-module-4-plan-review/SKILL.md +17 -76
- package/skills/erp-kit-module-5-impl/SKILL.md +1 -0
- package/skills/erp-kit-module-6-impl-review/SKILL.md +42 -120
- package/skills/erp-kit-module-6-impl-review/references/command-doc-test-parity.md +1 -1
- package/skills/erp-kit-module-6-impl-review/references/{error-implementation-parity.md → command-error-implementation-parity.md} +3 -3
- package/skills/erp-kit-module-6-impl-review/references/impl-parity-report-format.md +1 -1
- package/skills/erp-kit-module-6-impl-review/references/query-doc-code-parity.md +110 -0
- package/skills/erp-kit-module-6-impl-review/references/query-doc-test-parity.md +108 -0
- package/skills/erp-kit-module-6-impl-review/references/query-error-implementation-parity.md +100 -0
- package/skills/erp-kit-module-shared/references/commands.md +1 -1
- package/skills/erp-kit-module-shared/references/queries.md +5 -6
- package/src/commands/app/index.ts +18 -3
- package/src/commands/check.test.ts +1 -1
- package/src/commands/doc/module.ts +2 -3
- package/src/commands/doc/modules.test.ts +0 -7
- package/src/commands/doc/modules.ts +1 -2
- package/src/commands/doc/search.ts +1 -2
- package/src/commands/init.ts +4 -0
- package/src/commands/lib/distribute.test.ts +32 -1
- package/src/commands/lib/distribute.ts +47 -5
- package/src/commands/lib/sync-check-source.test.ts +1 -1
- package/src/commands/update.test.ts +16 -0
- package/src/commands/update.ts +4 -1
- package/src/generator/generate-code-boilerplate.test.ts +0 -1
- package/src/generator/generate-code.test.ts +10 -6
- package/src/generator/generate-errors.ts +1 -1
- package/src/generator/generate-permissions.ts +1 -1
- package/src/generator/generate-seed.ts +69 -0
- package/src/generator/generate-shells.ts +2 -2
- package/src/generator/stub-templates.ts +5 -5
- package/src/module.ts +59 -0
- package/src/modules/audit/command/activateAuditPolicy.generated.ts +1 -1
- package/src/modules/audit/command/activateAuditPolicy.test.ts +1 -1
- package/src/modules/audit/command/activateAuditPolicy.ts +1 -1
- package/src/modules/audit/command/createAuditPolicy.generated.ts +1 -1
- package/src/modules/audit/command/createAuditPolicy.test.ts +1 -1
- package/src/modules/audit/command/createAuditPolicy.ts +1 -1
- package/src/modules/audit/command/deactivateAuditPolicy.generated.ts +1 -1
- package/src/modules/audit/command/deactivateAuditPolicy.test.ts +2 -2
- package/src/modules/audit/command/deactivateAuditPolicy.ts +1 -1
- package/src/modules/audit/command/deleteAuditPolicy.generated.ts +1 -1
- package/src/modules/audit/command/deleteAuditPolicy.test.ts +1 -1
- package/src/modules/audit/command/deleteAuditPolicy.ts +1 -1
- package/src/modules/audit/command/logAuditEvent.generated.ts +1 -1
- package/src/modules/audit/command/logAuditEvent.test.ts +1 -1
- package/src/modules/audit/command/logAuditEvent.ts +1 -1
- package/src/modules/audit/command/reactivateAuditPolicy.generated.ts +1 -1
- package/src/modules/audit/command/reactivateAuditPolicy.test.ts +2 -2
- package/src/modules/audit/command/reactivateAuditPolicy.ts +1 -1
- package/src/modules/audit/command/registerAuditableEntity.generated.ts +1 -1
- package/src/modules/audit/command/registerAuditableEntity.test.ts +1 -1
- package/src/modules/audit/command/registerAuditableEntity.ts +1 -1
- package/src/modules/audit/command/replaceAuditPolicy.generated.ts +1 -1
- package/src/modules/audit/command/replaceAuditPolicy.test.ts +1 -1
- package/src/modules/audit/command/replaceAuditPolicy.ts +1 -1
- package/src/modules/audit/command/updateAuditPolicy.generated.ts +1 -1
- package/src/modules/audit/command/updateAuditPolicy.test.ts +1 -1
- package/src/modules/audit/command/updateAuditPolicy.ts +1 -1
- package/src/modules/audit/lib/errors.generated.ts +1 -1
- package/src/modules/audit/lib/permissions.generated.ts +1 -1
- package/src/modules/audit/lib/types.ts +6 -1
- package/src/modules/audit/permissions.ts +1 -1
- package/src/modules/audit/query/getAuditEntry.generated.ts +1 -1
- package/src/modules/audit/query/getAuditEntry.test.ts +2 -2
- package/src/modules/audit/query/getAuditEntry.ts +7 -1
- package/src/modules/audit/query/getAuditPolicy.generated.ts +1 -1
- package/src/modules/audit/query/getAuditPolicy.test.ts +2 -2
- package/src/modules/audit/query/getAuditPolicy.ts +7 -1
- package/src/modules/audit/query/getAuditSummary.generated.ts +1 -1
- package/src/modules/audit/query/getAuditSummary.test.ts +2 -2
- package/src/modules/audit/query/getAuditSummary.ts +7 -1
- package/src/modules/audit/query/getChangeDetails.generated.ts +1 -1
- package/src/modules/audit/query/getChangeDetails.test.ts +2 -2
- package/src/modules/audit/query/getChangeDetails.ts +7 -1
- package/src/modules/audit/query/listAuditPolicies.generated.ts +1 -1
- package/src/modules/audit/query/listAuditPolicies.test.ts +2 -2
- package/src/modules/audit/query/listAuditPolicies.ts +3 -3
- package/src/modules/audit/query/searchAuditEntries.generated.ts +1 -1
- package/src/modules/audit/query/searchAuditEntries.test.ts +2 -2
- package/src/modules/audit/query/searchAuditEntries.ts +7 -7
- package/src/modules/business-partner/README.md +2 -2
- package/src/modules/business-partner/command/activatePartner.generated.ts +1 -1
- package/src/modules/business-partner/command/activatePartner.ts +1 -1
- package/src/modules/business-partner/command/assignRoleToPartner.generated.ts +1 -1
- package/src/modules/business-partner/command/assignRoleToPartner.test.ts +1 -1
- package/src/modules/business-partner/command/assignRoleToPartner.ts +1 -1
- package/src/modules/business-partner/command/createContactPerson.generated.ts +1 -1
- package/src/modules/business-partner/command/createContactPerson.ts +1 -1
- package/src/modules/business-partner/command/createPartner.generated.ts +1 -1
- package/src/modules/business-partner/command/createPartner.test.ts +1 -1
- package/src/modules/business-partner/command/createPartner.ts +3 -4
- package/src/modules/business-partner/command/createPartnerAddress.generated.ts +1 -1
- package/src/modules/business-partner/command/createPartnerAddress.ts +1 -1
- package/src/modules/business-partner/command/createPartnerBankAccount.generated.ts +1 -1
- package/src/modules/business-partner/command/createPartnerBankAccount.test.ts +1 -1
- package/src/modules/business-partner/command/createPartnerBankAccount.ts +1 -1
- package/src/modules/business-partner/command/createPartnerIdentification.generated.ts +1 -1
- package/src/modules/business-partner/command/createPartnerIdentification.test.ts +1 -1
- package/src/modules/business-partner/command/createPartnerIdentification.ts +1 -1
- package/src/modules/business-partner/command/deactivateContactPerson.generated.ts +1 -1
- package/src/modules/business-partner/command/deactivateContactPerson.ts +1 -1
- package/src/modules/business-partner/command/deactivatePartner.generated.ts +1 -1
- package/src/modules/business-partner/command/deactivatePartner.ts +1 -1
- package/src/modules/business-partner/command/deleteContactPerson.generated.ts +1 -1
- package/src/modules/business-partner/command/deleteContactPerson.ts +1 -1
- package/src/modules/business-partner/command/deletePartner.generated.ts +1 -1
- package/src/modules/business-partner/command/deletePartner.ts +1 -1
- package/src/modules/business-partner/command/deletePartnerAddress.generated.ts +1 -1
- package/src/modules/business-partner/command/deletePartnerAddress.test.ts +1 -1
- package/src/modules/business-partner/command/deletePartnerAddress.ts +1 -1
- package/src/modules/business-partner/command/deletePartnerBankAccount.generated.ts +1 -1
- package/src/modules/business-partner/command/deletePartnerBankAccount.test.ts +1 -1
- package/src/modules/business-partner/command/deletePartnerBankAccount.ts +1 -1
- package/src/modules/business-partner/command/deletePartnerIdentification.generated.ts +1 -1
- package/src/modules/business-partner/command/deletePartnerIdentification.test.ts +1 -1
- package/src/modules/business-partner/command/deletePartnerIdentification.ts +1 -1
- package/src/modules/business-partner/command/reactivateContactPerson.generated.ts +1 -1
- package/src/modules/business-partner/command/reactivateContactPerson.ts +1 -1
- package/src/modules/business-partner/command/reactivatePartner.generated.ts +1 -1
- package/src/modules/business-partner/command/reactivatePartner.ts +1 -1
- package/src/modules/business-partner/command/removeRoleFromPartner.generated.ts +1 -1
- package/src/modules/business-partner/command/removeRoleFromPartner.test.ts +1 -1
- package/src/modules/business-partner/command/removeRoleFromPartner.ts +1 -1
- package/src/modules/business-partner/command/setDefaultPartnerAddress.generated.ts +1 -1
- package/src/modules/business-partner/command/setDefaultPartnerAddress.ts +1 -1
- package/src/modules/business-partner/command/setDefaultPartnerBankAccount.generated.ts +1 -1
- package/src/modules/business-partner/command/setDefaultPartnerBankAccount.test.ts +1 -1
- package/src/modules/business-partner/command/setDefaultPartnerBankAccount.ts +1 -1
- package/src/modules/business-partner/command/setPrimaryContactPerson.generated.ts +1 -1
- package/src/modules/business-partner/command/setPrimaryContactPerson.ts +1 -1
- package/src/modules/business-partner/command/updateContactPerson.generated.ts +1 -1
- package/src/modules/business-partner/command/updateContactPerson.ts +1 -1
- package/src/modules/business-partner/command/updatePartner.generated.ts +1 -1
- package/src/modules/business-partner/command/updatePartner.test.ts +1 -1
- package/src/modules/business-partner/command/updatePartner.ts +1 -1
- package/src/modules/business-partner/command/updatePartnerAddress.generated.ts +1 -1
- package/src/modules/business-partner/command/updatePartnerAddress.ts +1 -1
- package/src/modules/business-partner/command/updatePartnerBankAccount.generated.ts +1 -1
- package/src/modules/business-partner/command/updatePartnerBankAccount.test.ts +1 -1
- package/src/modules/business-partner/command/updatePartnerBankAccount.ts +1 -1
- package/src/modules/business-partner/command/updatePartnerIdentification.generated.ts +1 -1
- package/src/modules/business-partner/command/updatePartnerIdentification.test.ts +1 -1
- package/src/modules/business-partner/command/updatePartnerIdentification.ts +1 -1
- package/src/modules/business-partner/lib/errors.generated.ts +1 -1
- package/src/modules/business-partner/lib/permissions.generated.ts +1 -1
- package/src/modules/business-partner/lib/types.ts +6 -1
- package/src/modules/business-partner/module.ts +1 -1
- package/src/modules/business-partner/permissions.ts +1 -1
- package/src/modules/business-partner/query/getContactPerson.generated.ts +1 -1
- package/src/modules/business-partner/query/getContactPerson.ts +1 -1
- package/src/modules/business-partner/query/getDefaultPartnerAddress.generated.ts +1 -1
- package/src/modules/business-partner/query/getDefaultPartnerAddress.ts +1 -1
- package/src/modules/business-partner/query/getDefaultPartnerBankAccount.generated.ts +1 -1
- package/src/modules/business-partner/query/getDefaultPartnerBankAccount.ts +1 -1
- package/src/modules/business-partner/query/getPartner.generated.ts +1 -1
- package/src/modules/business-partner/query/getPartner.ts +1 -1
- package/src/modules/business-partner/query/getPartnerAddress.generated.ts +1 -1
- package/src/modules/business-partner/query/getPartnerAddress.ts +1 -1
- package/src/modules/business-partner/query/getPartnerBankAccount.generated.ts +1 -1
- package/src/modules/business-partner/query/getPartnerBankAccount.ts +1 -1
- package/src/modules/business-partner/query/getPartnerIdentification.generated.ts +1 -1
- package/src/modules/business-partner/query/getPartnerIdentification.ts +1 -1
- package/src/modules/business-partner/query/getPartnerRole.generated.ts +1 -1
- package/src/modules/business-partner/query/getPartnerRole.ts +1 -1
- package/src/modules/business-partner/query/getPrimaryContactPerson.generated.ts +1 -1
- package/src/modules/business-partner/query/getPrimaryContactPerson.ts +1 -1
- package/src/modules/business-partner/query/listContactPersonsByPartner.generated.ts +1 -1
- package/src/modules/business-partner/query/listContactPersonsByPartner.ts +2 -2
- package/src/modules/business-partner/query/listPartnerAddressesByPartner.generated.ts +1 -1
- package/src/modules/business-partner/query/listPartnerAddressesByPartner.ts +3 -3
- package/src/modules/business-partner/query/listPartnerBankAccountsByPartner.generated.ts +1 -1
- package/src/modules/business-partner/query/listPartnerBankAccountsByPartner.ts +2 -2
- package/src/modules/business-partner/query/listPartnerIdentificationsByPartner.generated.ts +1 -1
- package/src/modules/business-partner/query/listPartnerIdentificationsByPartner.ts +3 -3
- package/src/modules/business-partner/query/listPartnersByRole.generated.ts +1 -1
- package/src/modules/business-partner/query/listPartnersByRole.ts +4 -4
- package/src/modules/coa-management/command/activateAccount.generated.ts +1 -1
- package/src/modules/coa-management/command/activateAccount.test.ts +1 -1
- package/src/modules/coa-management/command/activateAccount.ts +1 -1
- package/src/modules/coa-management/command/activateChartOfAccounts.generated.ts +1 -1
- package/src/modules/coa-management/command/activateChartOfAccounts.test.ts +1 -1
- package/src/modules/coa-management/command/activateChartOfAccounts.ts +1 -1
- package/src/modules/coa-management/command/createAccount.generated.ts +1 -1
- package/src/modules/coa-management/command/createAccount.test.ts +1 -1
- package/src/modules/coa-management/command/createAccount.ts +1 -1
- package/src/modules/coa-management/command/createAccountGroup.generated.ts +1 -1
- package/src/modules/coa-management/command/createAccountGroup.test.ts +1 -1
- package/src/modules/coa-management/command/createAccountGroup.ts +1 -1
- package/src/modules/coa-management/command/createChartOfAccounts.generated.ts +1 -1
- package/src/modules/coa-management/command/createChartOfAccounts.test.ts +1 -1
- package/src/modules/coa-management/command/createChartOfAccounts.ts +1 -1
- package/src/modules/coa-management/command/deactivateAccount.generated.ts +1 -1
- package/src/modules/coa-management/command/deactivateAccount.test.ts +1 -1
- package/src/modules/coa-management/command/deactivateAccount.ts +1 -1
- package/src/modules/coa-management/command/deactivateChartOfAccounts.generated.ts +1 -1
- package/src/modules/coa-management/command/deactivateChartOfAccounts.test.ts +1 -1
- package/src/modules/coa-management/command/deactivateChartOfAccounts.ts +1 -1
- package/src/modules/coa-management/command/deleteAccount.generated.ts +1 -1
- package/src/modules/coa-management/command/deleteAccount.test.ts +1 -1
- package/src/modules/coa-management/command/deleteAccount.ts +1 -1
- package/src/modules/coa-management/command/deleteAccountGroup.generated.ts +1 -1
- package/src/modules/coa-management/command/deleteAccountGroup.test.ts +1 -1
- package/src/modules/coa-management/command/deleteAccountGroup.ts +1 -1
- package/src/modules/coa-management/command/deleteChartOfAccounts.generated.ts +1 -1
- package/src/modules/coa-management/command/deleteChartOfAccounts.test.ts +1 -1
- package/src/modules/coa-management/command/deleteChartOfAccounts.ts +1 -1
- package/src/modules/coa-management/command/moveAccountGroup.generated.ts +1 -1
- package/src/modules/coa-management/command/moveAccountGroup.test.ts +1 -1
- package/src/modules/coa-management/command/moveAccountGroup.ts +1 -1
- package/src/modules/coa-management/command/reactivateAccount.generated.ts +1 -1
- package/src/modules/coa-management/command/reactivateAccount.test.ts +1 -1
- package/src/modules/coa-management/command/reactivateAccount.ts +1 -1
- package/src/modules/coa-management/command/updateAccount.generated.ts +1 -1
- package/src/modules/coa-management/command/updateAccount.test.ts +1 -1
- package/src/modules/coa-management/command/updateAccount.ts +1 -1
- package/src/modules/coa-management/command/updateAccountGroup.generated.ts +1 -1
- package/src/modules/coa-management/command/updateAccountGroup.test.ts +1 -1
- package/src/modules/coa-management/command/updateAccountGroup.ts +1 -1
- package/src/modules/coa-management/command/updateChartOfAccounts.generated.ts +1 -1
- package/src/modules/coa-management/command/updateChartOfAccounts.test.ts +1 -1
- package/src/modules/coa-management/command/updateChartOfAccounts.ts +1 -1
- package/src/modules/coa-management/lib/errors.generated.ts +1 -1
- package/src/modules/coa-management/lib/permissions.generated.ts +1 -1
- package/src/modules/coa-management/lib/types.ts +6 -1
- package/src/modules/coa-management/module.ts +1 -1
- package/src/modules/coa-management/permissions.ts +1 -1
- package/src/modules/coa-management/query/detectCircularReference.generated.ts +1 -1
- package/src/modules/coa-management/query/detectCircularReference.ts +1 -1
- package/src/modules/coa-management/query/getAccount.generated.ts +1 -1
- package/src/modules/coa-management/query/getAccount.ts +1 -1
- package/src/modules/coa-management/query/getAccountGroup.generated.ts +1 -1
- package/src/modules/coa-management/query/getAccountGroup.ts +1 -1
- package/src/modules/coa-management/query/getChartOfAccounts.generated.ts +1 -1
- package/src/modules/coa-management/query/getChartOfAccounts.ts +1 -1
- package/src/modules/coa-management/query/listAccountGroups.generated.ts +1 -1
- package/src/modules/coa-management/query/listAccountGroups.ts +2 -2
- package/src/modules/coa-management/query/listAccounts.generated.ts +1 -1
- package/src/modules/coa-management/query/listAccounts.ts +3 -3
- package/src/modules/coa-management/query/listUnassignedAccounts.generated.ts +1 -1
- package/src/modules/coa-management/query/listUnassignedAccounts.ts +2 -2
- package/src/modules/inventory/README.md +65 -0
- package/src/modules/inventory/command/approveCountLine.generated.ts +6 -0
- package/src/modules/inventory/command/approveCountLine.test.ts +89 -0
- package/src/modules/inventory/command/approveCountLine.ts +68 -0
- package/src/modules/inventory/command/approveInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/approveInventoryAdjustment.test.ts +56 -0
- package/src/modules/inventory/command/approveInventoryAdjustment.ts +50 -0
- package/src/modules/inventory/command/assignSerialNumber.generated.ts +6 -0
- package/src/modules/inventory/command/assignSerialNumber.test.ts +133 -0
- package/src/modules/inventory/command/assignSerialNumber.ts +83 -0
- package/src/modules/inventory/command/cancelInventoryCount.generated.ts +6 -0
- package/src/modules/inventory/command/cancelInventoryCount.test.ts +114 -0
- package/src/modules/inventory/command/cancelInventoryCount.ts +62 -0
- package/src/modules/inventory/command/cancelStockMovement.generated.ts +6 -0
- package/src/modules/inventory/command/cancelStockMovement.test.ts +102 -0
- package/src/modules/inventory/command/cancelStockMovement.ts +56 -0
- package/src/modules/inventory/command/completeInventoryCount.generated.ts +6 -0
- package/src/modules/inventory/command/completeInventoryCount.test.ts +99 -0
- package/src/modules/inventory/command/completeInventoryCount.ts +70 -0
- package/src/modules/inventory/command/confirmInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/confirmInventoryAdjustment.test.ts +324 -0
- package/src/modules/inventory/command/confirmInventoryAdjustment.ts +194 -0
- package/src/modules/inventory/command/confirmStockMovement.generated.ts +6 -0
- package/src/modules/inventory/command/confirmStockMovement.test.ts +126 -0
- package/src/modules/inventory/command/confirmStockMovement.ts +131 -0
- package/src/modules/inventory/command/createInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/createInventoryAdjustment.test.ts +298 -0
- package/src/modules/inventory/command/createInventoryAdjustment.ts +124 -0
- package/src/modules/inventory/command/createInventoryCount.generated.ts +6 -0
- package/src/modules/inventory/command/createInventoryCount.test.ts +157 -0
- package/src/modules/inventory/command/createInventoryCount.ts +72 -0
- package/src/modules/inventory/command/createLot.generated.ts +6 -0
- package/src/modules/inventory/command/createLot.test.ts +106 -0
- package/src/modules/inventory/command/createLot.ts +72 -0
- package/src/modules/inventory/command/createStockMovement.generated.ts +6 -0
- package/src/modules/inventory/command/createStockMovement.test.ts +342 -0
- package/src/modules/inventory/command/createStockMovement.ts +172 -0
- package/src/modules/inventory/command/createStorageLocation.generated.ts +6 -0
- package/src/modules/inventory/command/createStorageLocation.test.ts +246 -0
- package/src/modules/inventory/command/createStorageLocation.ts +126 -0
- package/src/modules/inventory/command/createValuationPolicy.generated.ts +6 -0
- package/src/modules/inventory/command/createValuationPolicy.test.ts +75 -0
- package/src/modules/inventory/command/createValuationPolicy.ts +52 -0
- package/src/modules/inventory/command/createWarehouse.generated.ts +6 -0
- package/src/modules/inventory/command/createWarehouse.test.ts +143 -0
- package/src/modules/inventory/command/createWarehouse.ts +76 -0
- package/src/modules/inventory/command/deactivateStorageLocation.generated.ts +6 -0
- package/src/modules/inventory/command/deactivateStorageLocation.test.ts +69 -0
- package/src/modules/inventory/command/deactivateStorageLocation.ts +51 -0
- package/src/modules/inventory/command/deactivateWarehouse.generated.ts +6 -0
- package/src/modules/inventory/command/deactivateWarehouse.test.ts +75 -0
- package/src/modules/inventory/command/deactivateWarehouse.ts +45 -0
- package/src/modules/inventory/command/executeStockMovement.generated.ts +6 -0
- package/src/modules/inventory/command/executeStockMovement.test.ts +502 -0
- package/src/modules/inventory/command/executeStockMovement.ts +303 -0
- package/src/modules/inventory/command/reactivateStorageLocation.generated.ts +6 -0
- package/src/modules/inventory/command/reactivateStorageLocation.test.ts +78 -0
- package/src/modules/inventory/command/reactivateStorageLocation.ts +63 -0
- package/src/modules/inventory/command/reactivateWarehouse.generated.ts +6 -0
- package/src/modules/inventory/command/reactivateWarehouse.test.ts +87 -0
- package/src/modules/inventory/command/reactivateWarehouse.ts +65 -0
- package/src/modules/inventory/command/recordCountLine.generated.ts +6 -0
- package/src/modules/inventory/command/recordCountLine.test.ts +211 -0
- package/src/modules/inventory/command/recordCountLine.ts +81 -0
- package/src/modules/inventory/command/rejectCountLine.generated.ts +6 -0
- package/src/modules/inventory/command/rejectCountLine.test.ts +66 -0
- package/src/modules/inventory/command/rejectCountLine.ts +50 -0
- package/src/modules/inventory/command/rejectInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/rejectInventoryAdjustment.test.ts +69 -0
- package/src/modules/inventory/command/rejectInventoryAdjustment.ts +50 -0
- package/src/modules/inventory/command/releaseReservation.generated.ts +6 -0
- package/src/modules/inventory/command/releaseReservation.test.ts +65 -0
- package/src/modules/inventory/command/releaseReservation.ts +50 -0
- package/src/modules/inventory/command/reserveStock.generated.ts +6 -0
- package/src/modules/inventory/command/reserveStock.test.ts +141 -0
- package/src/modules/inventory/command/reserveStock.ts +88 -0
- package/src/modules/inventory/command/reviseInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/reviseInventoryAdjustment.test.ts +68 -0
- package/src/modules/inventory/command/reviseInventoryAdjustment.ts +48 -0
- package/src/modules/inventory/command/startInventoryCount.generated.ts +6 -0
- package/src/modules/inventory/command/startInventoryCount.test.ts +100 -0
- package/src/modules/inventory/command/startInventoryCount.ts +90 -0
- package/src/modules/inventory/command/submitInventoryAdjustment.generated.ts +6 -0
- package/src/modules/inventory/command/submitInventoryAdjustment.test.ts +53 -0
- package/src/modules/inventory/command/submitInventoryAdjustment.ts +47 -0
- package/src/modules/inventory/command/updateLot.generated.ts +6 -0
- package/src/modules/inventory/command/updateLot.test.ts +88 -0
- package/src/modules/inventory/command/updateLot.ts +52 -0
- package/src/modules/inventory/command/updateStockMovement.generated.ts +6 -0
- package/src/modules/inventory/command/updateStockMovement.test.ts +250 -0
- package/src/modules/inventory/command/updateStockMovement.ts +164 -0
- package/src/modules/inventory/command/updateStorageLocation.generated.ts +6 -0
- package/src/modules/inventory/command/updateStorageLocation.test.ts +72 -0
- package/src/modules/inventory/command/updateStorageLocation.ts +77 -0
- package/src/modules/inventory/command/updateValuationPolicy.generated.ts +6 -0
- package/src/modules/inventory/command/updateValuationPolicy.test.ts +68 -0
- package/src/modules/inventory/command/updateValuationPolicy.ts +74 -0
- package/src/modules/inventory/command/updateWarehouse.generated.ts +6 -0
- package/src/modules/inventory/command/updateWarehouse.test.ts +88 -0
- package/src/modules/inventory/command/updateWarehouse.ts +64 -0
- package/src/modules/inventory/db/costLayer.ts +54 -0
- package/src/modules/inventory/db/inventoryAdjustment.ts +88 -0
- package/src/modules/inventory/db/inventoryCount.ts +58 -0
- package/src/modules/inventory/db/inventoryCountLine.ts +61 -0
- package/src/modules/inventory/db/itemValuation.ts +50 -0
- package/src/modules/inventory/db/lot.ts +51 -0
- package/src/modules/inventory/db/lotStockLevel.ts +48 -0
- package/src/modules/inventory/db/serialNumber.ts +53 -0
- package/src/modules/inventory/db/stockLevel.ts +51 -0
- package/src/modules/inventory/db/stockMoveLine.ts +78 -0
- package/src/modules/inventory/db/stockMovement.ts +48 -0
- package/src/modules/inventory/db/storageLocation.ts +56 -0
- package/src/modules/inventory/db/valuationPolicy.ts +33 -0
- package/src/modules/inventory/db/warehouse.ts +45 -0
- package/src/modules/inventory/docs/commands/ApproveCountLine.md +44 -0
- package/src/modules/inventory/docs/commands/ApproveInventoryAdjustment.md +37 -0
- package/src/modules/inventory/docs/commands/AssignSerialNumber.md +46 -0
- package/src/modules/inventory/docs/commands/CancelInventoryCount.md +49 -0
- package/src/modules/inventory/docs/commands/CancelStockMovement.md +44 -0
- package/src/modules/inventory/docs/commands/CompleteInventoryCount.md +47 -0
- package/src/modules/inventory/docs/commands/ConfirmInventoryAdjustment.md +72 -0
- package/src/modules/inventory/docs/commands/ConfirmStockMovement.md +43 -0
- package/src/modules/inventory/docs/commands/CreateInventoryAdjustment.md +75 -0
- package/src/modules/inventory/docs/commands/CreateInventoryCount.md +49 -0
- package/src/modules/inventory/docs/commands/CreateLot.md +40 -0
- package/src/modules/inventory/docs/commands/CreateStockMovement.md +76 -0
- package/src/modules/inventory/docs/commands/CreateStorageLocation.md +66 -0
- package/src/modules/inventory/docs/commands/CreateValuationPolicy.md +45 -0
- package/src/modules/inventory/docs/commands/CreateWarehouse.md +47 -0
- package/src/modules/inventory/docs/commands/DeactivateStorageLocation.md +39 -0
- package/src/modules/inventory/docs/commands/DeactivateWarehouse.md +38 -0
- package/src/modules/inventory/docs/commands/ExecuteStockMovement.md +82 -0
- package/src/modules/inventory/docs/commands/ReactivateStorageLocation.md +42 -0
- package/src/modules/inventory/docs/commands/ReactivateWarehouse.md +42 -0
- package/src/modules/inventory/docs/commands/RecordCountLine.md +52 -0
- package/src/modules/inventory/docs/commands/RejectCountLine.md +42 -0
- package/src/modules/inventory/docs/commands/RejectInventoryAdjustment.md +38 -0
- package/src/modules/inventory/docs/commands/ReleaseReservation.md +37 -0
- package/src/modules/inventory/docs/commands/ReserveStock.md +49 -0
- package/src/modules/inventory/docs/commands/ReviseInventoryAdjustment.md +38 -0
- package/src/modules/inventory/docs/commands/StartInventoryCount.md +47 -0
- package/src/modules/inventory/docs/commands/SubmitInventoryAdjustment.md +37 -0
- package/src/modules/inventory/docs/commands/UpdateLot.md +41 -0
- package/src/modules/inventory/docs/commands/UpdateStockMovement.md +45 -0
- package/src/modules/inventory/docs/commands/UpdateStorageLocation.md +41 -0
- package/src/modules/inventory/docs/commands/UpdateValuationPolicy.md +44 -0
- package/src/modules/inventory/docs/commands/UpdateWarehouse.md +42 -0
- package/src/modules/inventory/docs/features/inventory-adjustment.md +64 -0
- package/src/modules/inventory/docs/features/inventory-count.md +78 -0
- package/src/modules/inventory/docs/features/inventory-valuation.md +77 -0
- package/src/modules/inventory/docs/features/lot-and-batch-tracking.md +81 -0
- package/src/modules/inventory/docs/features/scrap-management.md +63 -0
- package/src/modules/inventory/docs/features/serial-number-tracking.md +68 -0
- package/src/modules/inventory/docs/features/stock-movement.md +72 -0
- package/src/modules/inventory/docs/features/stock-tracking.md +78 -0
- package/src/modules/inventory/docs/features/warehouse-management.md +97 -0
- package/src/modules/inventory/docs/models/CostLayer.md +37 -0
- package/src/modules/inventory/docs/models/InventoryAdjustment.md +69 -0
- package/src/modules/inventory/docs/models/InventoryCount.md +53 -0
- package/src/modules/inventory/docs/models/InventoryCountLine.md +53 -0
- package/src/modules/inventory/docs/models/ItemValuation.md +38 -0
- package/src/modules/inventory/docs/models/Lot.md +45 -0
- package/src/modules/inventory/docs/models/LotStockLevel.md +34 -0
- package/src/modules/inventory/docs/models/SerialNumber.md +53 -0
- package/src/modules/inventory/docs/models/StockLevel.md +41 -0
- package/src/modules/inventory/docs/models/StockMoveLine.md +44 -0
- package/src/modules/inventory/docs/models/StockMovement.md +52 -0
- package/src/modules/inventory/docs/models/StorageLocation.md +55 -0
- package/src/modules/inventory/docs/models/ValuationPolicy.md +38 -0
- package/src/modules/inventory/docs/models/Warehouse.md +50 -0
- package/src/modules/inventory/docs/queries/GetInventoryAdjustment.md +40 -0
- package/src/modules/inventory/docs/queries/GetInventoryCount.md +43 -0
- package/src/modules/inventory/docs/queries/GetItemValuation.md +42 -0
- package/src/modules/inventory/docs/queries/GetLot.md +42 -0
- package/src/modules/inventory/docs/queries/GetSerialNumber.md +43 -0
- package/src/modules/inventory/docs/queries/GetSerialNumberHistory.md +50 -0
- package/src/modules/inventory/docs/queries/GetStockLevel.md +42 -0
- package/src/modules/inventory/docs/queries/GetStockMovement.md +41 -0
- package/src/modules/inventory/docs/queries/GetStorageLocation.md +40 -0
- package/src/modules/inventory/docs/queries/GetValuationPolicy.md +38 -0
- package/src/modules/inventory/docs/queries/GetWarehouse.md +40 -0
- package/src/modules/inventory/docs/queries/GetWarehouseStockSummary.md +50 -0
- package/src/modules/inventory/docs/queries/ListCostLayers.md +49 -0
- package/src/modules/inventory/docs/queries/ListExpiringLots.md +51 -0
- package/src/modules/inventory/docs/queries/ListInventoryAdjustments.md +47 -0
- package/src/modules/inventory/docs/queries/ListInventoryCounts.md +57 -0
- package/src/modules/inventory/docs/queries/ListItemValuations.md +44 -0
- package/src/modules/inventory/docs/queries/ListLots.md +57 -0
- package/src/modules/inventory/docs/queries/ListSerialNumbers.md +44 -0
- package/src/modules/inventory/docs/queries/ListStockLevels.md +49 -0
- package/src/modules/inventory/docs/queries/ListStockMovements.md +47 -0
- package/src/modules/inventory/docs/queries/ListStorageLocations.md +47 -0
- package/src/modules/inventory/docs/queries/ListValuationPolicies.md +38 -0
- package/src/modules/inventory/docs/queries/ListWarehouses.md +42 -0
- package/src/modules/inventory/docs/queries/TraceLotBackward.md +46 -0
- package/src/modules/inventory/docs/queries/TraceLotForward.md +46 -0
- package/src/modules/inventory/generated/.gitkeep +0 -0
- package/src/modules/inventory/generated/enums.ts +131 -0
- package/src/modules/inventory/generated/kysely-tailordb.ts +201 -0
- package/src/modules/inventory/index.ts +2 -0
- package/src/modules/inventory/lib/_db_deps.ts +17 -0
- package/src/modules/inventory/lib/errors.generated.ts +317 -0
- package/src/modules/inventory/lib/permissions.generated.ts +38 -0
- package/src/modules/inventory/lib/types.ts +92 -0
- package/src/modules/inventory/module.ts +202 -0
- package/src/modules/inventory/permissions.ts +3 -0
- package/src/modules/inventory/query/.gitkeep +0 -0
- package/src/modules/inventory/query/getInventoryAdjustment.generated.ts +5 -0
- package/src/modules/inventory/query/getInventoryAdjustment.test.ts +58 -0
- package/src/modules/inventory/query/getInventoryAdjustment.ts +16 -0
- package/src/modules/inventory/query/getInventoryCount.generated.ts +5 -0
- package/src/modules/inventory/query/getInventoryCount.test.ts +65 -0
- package/src/modules/inventory/query/getInventoryCount.ts +27 -0
- package/src/modules/inventory/query/getItemValuation.generated.ts +5 -0
- package/src/modules/inventory/query/getItemValuation.test.ts +72 -0
- package/src/modules/inventory/query/getItemValuation.ts +29 -0
- package/src/modules/inventory/query/getLot.generated.ts +5 -0
- package/src/modules/inventory/query/getLot.test.ts +62 -0
- package/src/modules/inventory/query/getLot.ts +28 -0
- package/src/modules/inventory/query/getSerialNumber.generated.ts +5 -0
- package/src/modules/inventory/query/getSerialNumber.test.ts +59 -0
- package/src/modules/inventory/query/getSerialNumber.ts +18 -0
- package/src/modules/inventory/query/getSerialNumberHistory.generated.ts +5 -0
- package/src/modules/inventory/query/getSerialNumberHistory.test.ts +80 -0
- package/src/modules/inventory/query/getSerialNumberHistory.ts +30 -0
- package/src/modules/inventory/query/getStockLevel.generated.ts +5 -0
- package/src/modules/inventory/query/getStockLevel.test.ts +70 -0
- package/src/modules/inventory/query/getStockLevel.ts +24 -0
- package/src/modules/inventory/query/getStockMovement.generated.ts +5 -0
- package/src/modules/inventory/query/getStockMovement.test.ts +62 -0
- package/src/modules/inventory/query/getStockMovement.ts +26 -0
- package/src/modules/inventory/query/getStorageLocation.generated.ts +5 -0
- package/src/modules/inventory/query/getStorageLocation.test.ts +54 -0
- package/src/modules/inventory/query/getStorageLocation.ts +26 -0
- package/src/modules/inventory/query/getValuationPolicy.generated.ts +5 -0
- package/src/modules/inventory/query/getValuationPolicy.test.ts +42 -0
- package/src/modules/inventory/query/getValuationPolicy.ts +16 -0
- package/src/modules/inventory/query/getWarehouse.generated.ts +5 -0
- package/src/modules/inventory/query/getWarehouse.test.ts +61 -0
- package/src/modules/inventory/query/getWarehouse.ts +26 -0
- package/src/modules/inventory/query/getWarehouseStockSummary.generated.ts +5 -0
- package/src/modules/inventory/query/getWarehouseStockSummary.test.ts +97 -0
- package/src/modules/inventory/query/getWarehouseStockSummary.ts +82 -0
- package/src/modules/inventory/query/listCostLayers.generated.ts +5 -0
- package/src/modules/inventory/query/listCostLayers.test.ts +58 -0
- package/src/modules/inventory/query/listCostLayers.ts +45 -0
- package/src/modules/inventory/query/listExpiringLots.generated.ts +5 -0
- package/src/modules/inventory/query/listExpiringLots.test.ts +70 -0
- package/src/modules/inventory/query/listExpiringLots.ts +74 -0
- package/src/modules/inventory/query/listInventoryAdjustments.generated.ts +5 -0
- package/src/modules/inventory/query/listInventoryAdjustments.test.ts +89 -0
- package/src/modules/inventory/query/listInventoryAdjustments.ts +59 -0
- package/src/modules/inventory/query/listInventoryCounts.generated.ts +5 -0
- package/src/modules/inventory/query/listInventoryCounts.test.ts +78 -0
- package/src/modules/inventory/query/listInventoryCounts.ts +55 -0
- package/src/modules/inventory/query/listItemValuations.generated.ts +5 -0
- package/src/modules/inventory/query/listItemValuations.test.ts +54 -0
- package/src/modules/inventory/query/listItemValuations.ts +39 -0
- package/src/modules/inventory/query/listLots.generated.ts +5 -0
- package/src/modules/inventory/query/listLots.test.ts +120 -0
- package/src/modules/inventory/query/listLots.ts +68 -0
- package/src/modules/inventory/query/listSerialNumbers.generated.ts +5 -0
- package/src/modules/inventory/query/listSerialNumbers.test.ts +58 -0
- package/src/modules/inventory/query/listSerialNumbers.ts +53 -0
- package/src/modules/inventory/query/listStockLevels.generated.ts +5 -0
- package/src/modules/inventory/query/listStockLevels.test.ts +73 -0
- package/src/modules/inventory/query/listStockLevels.ts +79 -0
- package/src/modules/inventory/query/listStockMovements.generated.ts +5 -0
- package/src/modules/inventory/query/listStockMovements.test.ts +98 -0
- package/src/modules/inventory/query/listStockMovements.ts +105 -0
- package/src/modules/inventory/query/listStorageLocations.generated.ts +5 -0
- package/src/modules/inventory/query/listStorageLocations.test.ts +70 -0
- package/src/modules/inventory/query/listStorageLocations.ts +53 -0
- package/src/modules/inventory/query/listValuationPolicies.generated.ts +5 -0
- package/src/modules/inventory/query/listValuationPolicies.test.ts +38 -0
- package/src/modules/inventory/query/listValuationPolicies.ts +39 -0
- package/src/modules/inventory/query/listWarehouses.generated.ts +5 -0
- package/src/modules/inventory/query/listWarehouses.test.ts +60 -0
- package/src/modules/inventory/query/listWarehouses.ts +39 -0
- package/src/modules/inventory/query/traceLotBackward.generated.ts +5 -0
- package/src/modules/inventory/query/traceLotBackward.test.ts +63 -0
- package/src/modules/inventory/query/traceLotBackward.ts +36 -0
- package/src/modules/inventory/query/traceLotForward.generated.ts +5 -0
- package/src/modules/inventory/query/traceLotForward.test.ts +63 -0
- package/src/modules/inventory/query/traceLotForward.ts +36 -0
- package/src/modules/inventory/tailor.config.ts +13 -0
- package/src/modules/inventory/tailor.d.ts +13 -0
- package/src/modules/inventory/testing/commandTestUtils.ts +29 -0
- package/src/modules/inventory/testing/fixtures.ts +412 -0
- package/src/modules/item-management/command/activateItem.generated.ts +1 -1
- package/src/modules/item-management/command/activateItem.ts +1 -1
- package/src/modules/item-management/command/assignItemToTaxonomy.generated.ts +1 -1
- package/src/modules/item-management/command/assignItemToTaxonomy.ts +1 -1
- package/src/modules/item-management/command/createItem.generated.ts +1 -1
- package/src/modules/item-management/command/createItem.test.ts +1 -1
- package/src/modules/item-management/command/createItem.ts +1 -1
- package/src/modules/item-management/command/createTaxonomyNode.generated.ts +1 -1
- package/src/modules/item-management/command/createTaxonomyNode.test.ts +1 -1
- package/src/modules/item-management/command/createTaxonomyNode.ts +1 -1
- package/src/modules/item-management/command/deactivateItem.generated.ts +1 -1
- package/src/modules/item-management/command/deactivateItem.ts +1 -1
- package/src/modules/item-management/command/deleteItem.generated.ts +1 -1
- package/src/modules/item-management/command/deleteItem.ts +1 -1
- package/src/modules/item-management/command/deleteTaxonomyNode.generated.ts +1 -1
- package/src/modules/item-management/command/deleteTaxonomyNode.ts +1 -1
- package/src/modules/item-management/command/moveTaxonomyNode.generated.ts +1 -1
- package/src/modules/item-management/command/moveTaxonomyNode.test.ts +1 -1
- package/src/modules/item-management/command/moveTaxonomyNode.ts +1 -1
- package/src/modules/item-management/command/reactivateItem.generated.ts +1 -1
- package/src/modules/item-management/command/reactivateItem.ts +1 -1
- package/src/modules/item-management/command/removeItemFromTaxonomy.generated.ts +1 -1
- package/src/modules/item-management/command/removeItemFromTaxonomy.ts +1 -1
- package/src/modules/item-management/command/updateItem.generated.ts +1 -1
- package/src/modules/item-management/command/updateItem.test.ts +1 -1
- package/src/modules/item-management/command/updateItem.ts +1 -1
- package/src/modules/item-management/command/updateTaxonomyNode.generated.ts +1 -1
- package/src/modules/item-management/command/updateTaxonomyNode.ts +1 -1
- package/src/modules/item-management/docs/models/{item.md → Item.md} +1 -1
- package/src/modules/item-management/lib/errors.generated.ts +1 -1
- package/src/modules/item-management/lib/permissions.generated.ts +1 -1
- package/src/modules/item-management/lib/types.ts +6 -1
- package/src/modules/item-management/module.ts +1 -1
- package/src/modules/item-management/query/calculateNodeDepth.generated.ts +1 -1
- package/src/modules/item-management/query/calculateNodeDepth.ts +1 -1
- package/src/modules/item-management/query/calculateSubtreeDepth.generated.ts +1 -1
- package/src/modules/item-management/query/calculateSubtreeDepth.ts +1 -1
- package/src/modules/item-management/query/detectCircularReference.generated.ts +1 -1
- package/src/modules/item-management/query/detectCircularReference.ts +1 -1
- package/src/modules/item-management/query/getItem.generated.ts +1 -1
- package/src/modules/item-management/query/getItem.ts +1 -1
- package/src/modules/item-management/query/getItemTaxonomyAssignment.generated.ts +1 -1
- package/src/modules/item-management/query/getItemTaxonomyAssignment.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNode.generated.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNode.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNodeAssignments.generated.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNodeAssignments.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNodeChildren.generated.ts +1 -1
- package/src/modules/item-management/query/getTaxonomyNodeChildren.ts +1 -1
- package/src/modules/organization/command/activateCompany.generated.ts +1 -1
- package/src/modules/organization/command/activateCompany.test.ts +1 -1
- package/src/modules/organization/command/activateCompany.ts +1 -1
- package/src/modules/organization/command/createCompany.generated.ts +1 -1
- package/src/modules/organization/command/createCompany.test.ts +1 -1
- package/src/modules/organization/command/createCompany.ts +1 -1
- package/src/modules/organization/command/createDepartment.generated.ts +1 -1
- package/src/modules/organization/command/createDepartment.ts +1 -1
- package/src/modules/organization/command/createSite.generated.ts +1 -1
- package/src/modules/organization/command/createSite.ts +1 -1
- package/src/modules/organization/command/deactivateCompany.generated.ts +1 -1
- package/src/modules/organization/command/deactivateCompany.ts +1 -1
- package/src/modules/organization/command/deactivateDepartment.generated.ts +1 -1
- package/src/modules/organization/command/deactivateDepartment.ts +1 -1
- package/src/modules/organization/command/deactivateSite.generated.ts +1 -1
- package/src/modules/organization/command/deactivateSite.ts +1 -1
- package/src/modules/organization/command/deleteCompany.generated.ts +1 -1
- package/src/modules/organization/command/deleteCompany.ts +1 -1
- package/src/modules/organization/command/reactivateCompany.generated.ts +1 -1
- package/src/modules/organization/command/reactivateCompany.ts +1 -1
- package/src/modules/organization/command/reactivateDepartment.generated.ts +1 -1
- package/src/modules/organization/command/reactivateDepartment.ts +1 -1
- package/src/modules/organization/command/reactivateSite.generated.ts +1 -1
- package/src/modules/organization/command/reactivateSite.ts +1 -1
- package/src/modules/organization/command/updateCompany.generated.ts +1 -1
- package/src/modules/organization/command/updateCompany.test.ts +1 -1
- package/src/modules/organization/command/updateCompany.ts +1 -1
- package/src/modules/organization/command/updateDepartment.generated.ts +1 -1
- package/src/modules/organization/command/updateDepartment.ts +1 -1
- package/src/modules/organization/command/updateSite.generated.ts +1 -1
- package/src/modules/organization/command/updateSite.ts +1 -1
- package/src/modules/organization/lib/errors.generated.ts +1 -1
- package/src/modules/organization/lib/permissions.generated.ts +1 -1
- package/src/modules/organization/lib/types.ts +6 -1
- package/src/modules/organization/module.ts +1 -1
- package/src/modules/organization/permissions.ts +1 -1
- package/src/modules/organization/query/detectDepartmentCircularReference.generated.ts +1 -1
- package/src/modules/organization/query/detectDepartmentCircularReference.ts +1 -1
- package/src/modules/organization/query/getCompany.generated.ts +1 -1
- package/src/modules/organization/query/getCompany.ts +1 -1
- package/src/modules/organization/query/getDepartment.generated.ts +1 -1
- package/src/modules/organization/query/getDepartment.ts +1 -1
- package/src/modules/organization/query/getDepartmentChildren.generated.ts +1 -1
- package/src/modules/organization/query/getDepartmentChildren.ts +1 -1
- package/src/modules/organization/query/getSite.generated.ts +1 -1
- package/src/modules/organization/query/getSite.ts +1 -1
- package/src/modules/organization/query/listDepartmentsByCompany.generated.ts +1 -1
- package/src/modules/organization/query/listDepartmentsByCompany.ts +2 -2
- package/src/modules/organization/query/listSitesByCompany.generated.ts +1 -1
- package/src/modules/organization/query/listSitesByCompany.ts +2 -2
- package/src/modules/primitives/command/activateCategory.generated.ts +1 -1
- package/src/modules/primitives/command/activateCategory.ts +1 -1
- package/src/modules/primitives/command/activateCurrency.generated.ts +1 -1
- package/src/modules/primitives/command/activateCurrency.ts +1 -1
- package/src/modules/primitives/command/activateUnit.generated.ts +1 -1
- package/src/modules/primitives/command/activateUnit.ts +1 -1
- package/src/modules/primitives/command/createCategory.generated.ts +1 -1
- package/src/modules/primitives/command/createCategory.ts +1 -1
- package/src/modules/primitives/command/createCurrency.generated.ts +1 -1
- package/src/modules/primitives/command/createCurrency.ts +1 -1
- package/src/modules/primitives/command/createExchangeRate.generated.ts +1 -1
- package/src/modules/primitives/command/createExchangeRate.ts +1 -1
- package/src/modules/primitives/command/createUnit.generated.ts +1 -1
- package/src/modules/primitives/command/createUnit.ts +1 -1
- package/src/modules/primitives/command/deactivateCategory.generated.ts +1 -1
- package/src/modules/primitives/command/deactivateCategory.ts +1 -1
- package/src/modules/primitives/command/deactivateCurrency.generated.ts +1 -1
- package/src/modules/primitives/command/deactivateCurrency.ts +1 -1
- package/src/modules/primitives/command/deactivateUnit.generated.ts +1 -1
- package/src/modules/primitives/command/deactivateUnit.ts +1 -1
- package/src/modules/primitives/command/setBaseCurrency.generated.ts +1 -1
- package/src/modules/primitives/command/setBaseCurrency.ts +1 -1
- package/src/modules/primitives/command/setReferenceUnit.generated.ts +1 -1
- package/src/modules/primitives/command/setReferenceUnit.ts +1 -1
- package/src/modules/primitives/lib/errors.generated.ts +1 -1
- package/src/modules/primitives/lib/permissions.generated.ts +1 -1
- package/src/modules/primitives/lib/types.ts +6 -1
- package/src/modules/primitives/module.ts +1 -1
- package/src/modules/primitives/query/convertAmount.generated.ts +1 -1
- package/src/modules/primitives/query/convertAmount.test.ts +1 -1
- package/src/modules/primitives/query/convertAmount.ts +1 -1
- package/src/modules/primitives/query/convertQuantity.generated.ts +1 -1
- package/src/modules/primitives/query/convertQuantity.test.ts +1 -1
- package/src/modules/primitives/query/convertQuantity.ts +1 -1
- package/src/modules/primitives/query/getBaseCurrency.generated.ts +1 -1
- package/src/modules/primitives/query/getBaseCurrency.test.ts +1 -1
- package/src/modules/primitives/query/getBaseCurrency.ts +1 -1
- package/src/modules/primitives/query/getCurrency.generated.ts +1 -1
- package/src/modules/primitives/query/getCurrency.ts +1 -1
- package/src/modules/primitives/query/getUnit.generated.ts +1 -1
- package/src/modules/primitives/query/getUnit.ts +1 -1
- package/src/modules/primitives/query/getUoMCategory.generated.ts +1 -1
- package/src/modules/primitives/query/getUoMCategory.ts +1 -1
- package/src/modules/primitives/query/listUnitsByCategory.generated.ts +1 -1
- package/src/modules/primitives/query/listUnitsByCategory.ts +2 -2
- package/src/modules/primitives/seed/currencies.ts +22 -0
- package/src/modules/primitives/seed/exchangeRates.ts +22 -0
- package/src/modules/primitives/seed/index.ts +4 -0
- package/src/modules/primitives/seed/seed.test.ts +80 -0
- package/src/modules/primitives/seed/units.ts +62 -0
- package/src/modules/primitives/seed/uomCategories.ts +24 -0
- package/src/modules/product-management/command/activateProduct.generated.ts +1 -1
- package/src/modules/product-management/command/activateProduct.ts +1 -1
- package/src/modules/product-management/command/assignProductToCategory.generated.ts +1 -1
- package/src/modules/product-management/command/assignProductToCategory.ts +1 -1
- package/src/modules/product-management/command/createProduct.generated.ts +1 -1
- package/src/modules/product-management/command/createProduct.test.ts +1 -1
- package/src/modules/product-management/command/createProduct.ts +1 -1
- package/src/modules/product-management/command/createProductAttribute.generated.ts +1 -1
- package/src/modules/product-management/command/createProductAttribute.ts +1 -1
- package/src/modules/product-management/command/createProductAttributeValue.generated.ts +1 -1
- package/src/modules/product-management/command/createProductAttributeValue.ts +1 -1
- package/src/modules/product-management/command/createProductCategory.generated.ts +1 -1
- package/src/modules/product-management/command/createProductCategory.test.ts +1 -1
- package/src/modules/product-management/command/createProductCategory.ts +1 -1
- package/src/modules/product-management/command/deactivateProduct.generated.ts +1 -1
- package/src/modules/product-management/command/deactivateProduct.ts +1 -1
- package/src/modules/product-management/command/deleteProduct.generated.ts +1 -1
- package/src/modules/product-management/command/deleteProduct.ts +1 -1
- package/src/modules/product-management/command/deleteProductAttribute.generated.ts +1 -1
- package/src/modules/product-management/command/deleteProductAttribute.ts +1 -1
- package/src/modules/product-management/command/deleteProductAttributeValue.generated.ts +1 -1
- package/src/modules/product-management/command/deleteProductAttributeValue.ts +1 -1
- package/src/modules/product-management/command/deleteProductCategory.generated.ts +1 -1
- package/src/modules/product-management/command/deleteProductCategory.ts +1 -1
- package/src/modules/product-management/command/generateVariants.generated.ts +1 -1
- package/src/modules/product-management/command/generateVariants.test.ts +1 -1
- package/src/modules/product-management/command/generateVariants.ts +1 -1
- package/src/modules/product-management/command/moveProductCategory.generated.ts +1 -1
- package/src/modules/product-management/command/moveProductCategory.test.ts +1 -1
- package/src/modules/product-management/command/moveProductCategory.ts +1 -1
- package/src/modules/product-management/command/reactivateProduct.generated.ts +1 -1
- package/src/modules/product-management/command/reactivateProduct.ts +1 -1
- package/src/modules/product-management/command/removeProductFromCategory.generated.ts +1 -1
- package/src/modules/product-management/command/removeProductFromCategory.ts +1 -1
- package/src/modules/product-management/command/setProductAttributeAssignment.generated.ts +1 -1
- package/src/modules/product-management/command/setProductAttributeAssignment.ts +1 -1
- package/src/modules/product-management/command/updateProduct.generated.ts +1 -1
- package/src/modules/product-management/command/updateProduct.test.ts +1 -1
- package/src/modules/product-management/command/updateProduct.ts +1 -1
- package/src/modules/product-management/command/updateProductAttribute.generated.ts +1 -1
- package/src/modules/product-management/command/updateProductAttribute.ts +1 -1
- package/src/modules/product-management/command/updateProductAttributeValue.generated.ts +1 -1
- package/src/modules/product-management/command/updateProductAttributeValue.ts +1 -1
- package/src/modules/product-management/command/updateProductCategory.generated.ts +1 -1
- package/src/modules/product-management/command/updateProductCategory.ts +1 -1
- package/src/modules/product-management/lib/errors.generated.ts +1 -1
- package/src/modules/product-management/lib/permissions.generated.ts +1 -1
- package/src/modules/product-management/lib/types.ts +6 -1
- package/src/modules/product-management/module.ts +1 -1
- package/src/modules/product-management/query/calculateCategoryDepth.generated.ts +1 -1
- package/src/modules/product-management/query/calculateCategoryDepth.ts +1 -1
- package/src/modules/product-management/query/detectCategoryCircularReference.generated.ts +1 -1
- package/src/modules/product-management/query/detectCategoryCircularReference.ts +1 -1
- package/src/modules/product-management/query/getProduct.generated.ts +1 -1
- package/src/modules/product-management/query/getProduct.ts +1 -1
- package/src/modules/product-management/query/getProductAttribute.generated.ts +1 -1
- package/src/modules/product-management/query/getProductAttribute.ts +1 -1
- package/src/modules/product-management/query/getProductAttributeAssignment.generated.ts +1 -1
- package/src/modules/product-management/query/getProductAttributeAssignment.ts +1 -1
- package/src/modules/product-management/query/getProductAttributeValue.generated.ts +1 -1
- package/src/modules/product-management/query/getProductAttributeValue.ts +1 -1
- package/src/modules/product-management/query/getProductCategory.generated.ts +1 -1
- package/src/modules/product-management/query/getProductCategory.ts +1 -1
- package/src/modules/product-management/query/getProductCategoryAssignment.generated.ts +1 -1
- package/src/modules/product-management/query/getProductCategoryAssignment.ts +1 -1
- package/src/modules/product-management/query/getProductVariant.generated.ts +1 -1
- package/src/modules/product-management/query/getProductVariant.ts +1 -1
- package/src/modules/product-management/query/listAttributeAssignmentsByAttribute.generated.ts +1 -1
- package/src/modules/product-management/query/listAttributeAssignmentsByAttribute.ts +1 -1
- package/src/modules/product-management/query/listCategoryAssignmentsByProduct.generated.ts +1 -1
- package/src/modules/product-management/query/listCategoryAssignmentsByProduct.ts +1 -1
- package/src/modules/product-management/query/listProductAttributeAssignments.generated.ts +1 -1
- package/src/modules/product-management/query/listProductAttributeAssignments.ts +1 -1
- package/src/modules/product-management/query/listProductAttributeValues.generated.ts +1 -1
- package/src/modules/product-management/query/listProductAttributeValues.ts +1 -1
- package/src/modules/product-management/query/listProductCategoryAssignments.generated.ts +1 -1
- package/src/modules/product-management/query/listProductCategoryAssignments.ts +1 -1
- package/src/modules/product-management/query/listProductCategoryChildren.generated.ts +1 -1
- package/src/modules/product-management/query/listProductCategoryChildren.ts +1 -1
- package/src/modules/product-management/query/listProductVariants.generated.ts +1 -1
- package/src/modules/product-management/query/listProductVariants.ts +1 -1
- package/src/modules/purchase/README.md +63 -0
- package/src/modules/purchase/command/.gitkeep +0 -0
- package/src/modules/purchase/command/activatePurchasePaymentTerm.generated.ts +6 -0
- package/src/modules/purchase/command/activatePurchasePaymentTerm.test.ts +53 -0
- package/src/modules/purchase/command/activatePurchasePaymentTerm.ts +39 -0
- package/src/modules/purchase/command/activatePurchasePriceList.generated.ts +6 -0
- package/src/modules/purchase/command/activatePurchasePriceList.test.ts +39 -0
- package/src/modules/purchase/command/activatePurchasePriceList.ts +32 -0
- package/src/modules/purchase/command/activatePurchasePriceRule.generated.ts +6 -0
- package/src/modules/purchase/command/activatePurchasePriceRule.test.ts +133 -0
- package/src/modules/purchase/command/activatePurchasePriceRule.ts +75 -0
- package/src/modules/purchase/command/approvePurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/approvePurchaseOrder.test.ts +161 -0
- package/src/modules/purchase/command/approvePurchaseOrder.ts +89 -0
- package/src/modules/purchase/command/cancelGoodsReceipt.generated.ts +6 -0
- package/src/modules/purchase/command/cancelGoodsReceipt.test.ts +37 -0
- package/src/modules/purchase/command/cancelGoodsReceipt.ts +29 -0
- package/src/modules/purchase/command/cancelPurchaseBill.generated.ts +6 -0
- package/src/modules/purchase/command/cancelPurchaseBill.test.ts +101 -0
- package/src/modules/purchase/command/cancelPurchaseBill.ts +84 -0
- package/src/modules/purchase/command/cancelPurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/cancelPurchaseOrder.test.ts +119 -0
- package/src/modules/purchase/command/cancelPurchaseOrder.ts +65 -0
- package/src/modules/purchase/command/closePurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/closePurchaseOrder.test.ts +128 -0
- package/src/modules/purchase/command/closePurchaseOrder.ts +58 -0
- package/src/modules/purchase/command/createGoodsReceipt.generated.ts +6 -0
- package/src/modules/purchase/command/createGoodsReceipt.test.ts +233 -0
- package/src/modules/purchase/command/createGoodsReceipt.ts +93 -0
- package/src/modules/purchase/command/createPurchaseBill.generated.ts +6 -0
- package/src/modules/purchase/command/createPurchaseBill.test.ts +277 -0
- package/src/modules/purchase/command/createPurchaseBill.ts +107 -0
- package/src/modules/purchase/command/createPurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/createPurchaseOrder.test.ts +291 -0
- package/src/modules/purchase/command/createPurchaseOrder.ts +131 -0
- package/src/modules/purchase/command/createPurchasePaymentTerm.generated.ts +6 -0
- package/src/modules/purchase/command/createPurchasePaymentTerm.test.ts +140 -0
- package/src/modules/purchase/command/createPurchasePaymentTerm.ts +66 -0
- package/src/modules/purchase/command/createPurchasePriceList.generated.ts +6 -0
- package/src/modules/purchase/command/createPurchasePriceList.test.ts +108 -0
- package/src/modules/purchase/command/createPurchasePriceList.ts +63 -0
- package/src/modules/purchase/command/createPurchasePriceRule.generated.ts +6 -0
- package/src/modules/purchase/command/createPurchasePriceRule.test.ts +139 -0
- package/src/modules/purchase/command/createPurchasePriceRule.ts +95 -0
- package/src/modules/purchase/command/deactivatePurchasePaymentTerm.generated.ts +6 -0
- package/src/modules/purchase/command/deactivatePurchasePaymentTerm.test.ts +49 -0
- package/src/modules/purchase/command/deactivatePurchasePaymentTerm.ts +41 -0
- package/src/modules/purchase/command/deactivatePurchasePriceList.generated.ts +6 -0
- package/src/modules/purchase/command/deactivatePurchasePriceList.test.ts +50 -0
- package/src/modules/purchase/command/deactivatePurchasePriceList.ts +32 -0
- package/src/modules/purchase/command/deactivatePurchasePriceRule.generated.ts +6 -0
- package/src/modules/purchase/command/deactivatePurchasePriceRule.test.ts +50 -0
- package/src/modules/purchase/command/deactivatePurchasePriceRule.ts +32 -0
- package/src/modules/purchase/command/matchPurchaseBill.generated.ts +6 -0
- package/src/modules/purchase/command/matchPurchaseBill.test.ts +188 -0
- package/src/modules/purchase/command/matchPurchaseBill.ts +146 -0
- package/src/modules/purchase/command/postGoodsReceipt.generated.ts +6 -0
- package/src/modules/purchase/command/postGoodsReceipt.test.ts +210 -0
- package/src/modules/purchase/command/postGoodsReceipt.ts +143 -0
- package/src/modules/purchase/command/rejectPurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/rejectPurchaseOrder.test.ts +79 -0
- package/src/modules/purchase/command/rejectPurchaseOrder.ts +41 -0
- package/src/modules/purchase/command/releasePurchaseBill.generated.ts +6 -0
- package/src/modules/purchase/command/releasePurchaseBill.test.ts +94 -0
- package/src/modules/purchase/command/releasePurchaseBill.ts +111 -0
- package/src/modules/purchase/command/setSupplierDefaultPurchasePaymentTerm.generated.ts +6 -0
- package/src/modules/purchase/command/setSupplierDefaultPurchasePaymentTerm.test.ts +171 -0
- package/src/modules/purchase/command/setSupplierDefaultPurchasePaymentTerm.ts +90 -0
- package/src/modules/purchase/command/submitPurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/submitPurchaseOrder.test.ts +98 -0
- package/src/modules/purchase/command/submitPurchaseOrder.ts +73 -0
- package/src/modules/purchase/command/updateGoodsReceipt.generated.ts +6 -0
- package/src/modules/purchase/command/updateGoodsReceipt.test.ts +115 -0
- package/src/modules/purchase/command/updateGoodsReceipt.ts +73 -0
- package/src/modules/purchase/command/updatePurchaseBill.generated.ts +6 -0
- package/src/modules/purchase/command/updatePurchaseBill.test.ts +137 -0
- package/src/modules/purchase/command/updatePurchaseBill.ts +89 -0
- package/src/modules/purchase/command/updatePurchaseOrder.generated.ts +6 -0
- package/src/modules/purchase/command/updatePurchaseOrder.test.ts +195 -0
- package/src/modules/purchase/command/updatePurchaseOrder.ts +121 -0
- package/src/modules/purchase/command/updatePurchasePaymentTerm.generated.ts +6 -0
- package/src/modules/purchase/command/updatePurchasePaymentTerm.test.ts +154 -0
- package/src/modules/purchase/command/updatePurchasePaymentTerm.ts +73 -0
- package/src/modules/purchase/command/updatePurchasePriceList.generated.ts +6 -0
- package/src/modules/purchase/command/updatePurchasePriceList.test.ts +73 -0
- package/src/modules/purchase/command/updatePurchasePriceList.ts +55 -0
- package/src/modules/purchase/command/updatePurchasePriceRule.generated.ts +6 -0
- package/src/modules/purchase/command/updatePurchasePriceRule.test.ts +191 -0
- package/src/modules/purchase/command/updatePurchasePriceRule.ts +104 -0
- package/src/modules/purchase/db/.gitkeep +0 -0
- package/src/modules/purchase/db/goodsReceipt.ts +62 -0
- package/src/modules/purchase/db/purchaseBill.ts +74 -0
- package/src/modules/purchase/db/purchaseOrder.ts +100 -0
- package/src/modules/purchase/db/purchasePaymentTerm.ts +46 -0
- package/src/modules/purchase/db/purchasePriceList.ts +53 -0
- package/src/modules/purchase/db/purchasePriceRule.ts +74 -0
- package/src/modules/purchase/db/supplierProfile.ts +59 -0
- package/src/modules/purchase/docs/commands/ActivatePurchasePaymentTerm.md +39 -0
- package/src/modules/purchase/docs/commands/ActivatePurchasePriceList.md +37 -0
- package/src/modules/purchase/docs/commands/ActivatePurchasePriceRule.md +47 -0
- package/src/modules/purchase/docs/commands/ApprovePurchaseOrder.md +55 -0
- package/src/modules/purchase/docs/commands/CancelGoodsReceipt.md +39 -0
- package/src/modules/purchase/docs/commands/CancelPurchaseBill.md +49 -0
- package/src/modules/purchase/docs/commands/CancelPurchaseOrder.md +47 -0
- package/src/modules/purchase/docs/commands/ClosePurchaseOrder.md +49 -0
- package/src/modules/purchase/docs/commands/CreateGoodsReceipt.md +54 -0
- package/src/modules/purchase/docs/commands/CreatePurchaseBill.md +59 -0
- package/src/modules/purchase/docs/commands/CreatePurchaseOrder.md +66 -0
- package/src/modules/purchase/docs/commands/CreatePurchasePaymentTerm.md +52 -0
- package/src/modules/purchase/docs/commands/CreatePurchasePriceList.md +48 -0
- package/src/modules/purchase/docs/commands/CreatePurchasePriceRule.md +62 -0
- package/src/modules/purchase/docs/commands/DeactivatePurchasePaymentTerm.md +42 -0
- package/src/modules/purchase/docs/commands/DeactivatePurchasePriceList.md +39 -0
- package/src/modules/purchase/docs/commands/DeactivatePurchasePriceRule.md +39 -0
- package/src/modules/purchase/docs/commands/MatchPurchaseBill.md +63 -0
- package/src/modules/purchase/docs/commands/PostGoodsReceipt.md +61 -0
- package/src/modules/purchase/docs/commands/RejectPurchaseOrder.md +44 -0
- package/src/modules/purchase/docs/commands/ReleasePurchaseBill.md +48 -0
- package/src/modules/purchase/docs/commands/SetSupplierDefaultPurchasePaymentTerm.md +50 -0
- package/src/modules/purchase/docs/commands/SubmitPurchaseOrder.md +51 -0
- package/src/modules/purchase/docs/commands/UpdateGoodsReceipt.md +48 -0
- package/src/modules/purchase/docs/commands/UpdatePurchaseBill.md +51 -0
- package/src/modules/purchase/docs/commands/UpdatePurchaseOrder.md +59 -0
- package/src/modules/purchase/docs/commands/UpdatePurchasePaymentTerm.md +51 -0
- package/src/modules/purchase/docs/commands/UpdatePurchasePriceList.md +43 -0
- package/src/modules/purchase/docs/commands/UpdatePurchasePriceRule.md +60 -0
- package/src/modules/purchase/docs/features/goods-receipt-matching.md +71 -0
- package/src/modules/purchase/docs/features/purchase-order-lifecycle.md +87 -0
- package/src/modules/purchase/docs/features/purchase-payment-terms.md +67 -0
- package/src/modules/purchase/docs/features/supplier-bill-matching.md +79 -0
- package/src/modules/purchase/docs/features/supplier-purchase-pricing.md +72 -0
- package/src/modules/purchase/docs/models/GoodsReceipt.md +58 -0
- package/src/modules/purchase/docs/models/PurchaseBill.md +68 -0
- package/src/modules/purchase/docs/models/PurchaseOrder.md +88 -0
- package/src/modules/purchase/docs/models/PurchasePaymentTerm.md +59 -0
- package/src/modules/purchase/docs/models/PurchasePriceList.md +53 -0
- package/src/modules/purchase/docs/models/PurchasePriceRule.md +58 -0
- package/src/modules/purchase/docs/models/SupplierProfile.md +37 -0
- package/src/modules/purchase/docs/queries/CalculatePurchaseBillDueSchedule.md +47 -0
- package/src/modules/purchase/docs/queries/CalculatePurchasePrice.md +53 -0
- package/src/modules/purchase/docs/queries/GetGoodsReceipt.md +36 -0
- package/src/modules/purchase/docs/queries/GetPurchaseBill.md +41 -0
- package/src/modules/purchase/docs/queries/GetPurchaseOrder.md +42 -0
- package/src/modules/purchase/docs/queries/GetPurchasePaymentTerm.md +36 -0
- package/src/modules/purchase/docs/queries/GetPurchasePriceList.md +36 -0
- package/src/modules/purchase/docs/queries/GetSupplierProfile.md +36 -0
- package/src/modules/purchase/executor/.gitkeep +0 -0
- package/src/modules/purchase/generated/.gitkeep +0 -0
- package/src/modules/purchase/generated/enums.ts +63 -0
- package/src/modules/purchase/generated/kysely-tailordb.ts +186 -0
- package/src/modules/purchase/index.ts +2 -0
- package/src/modules/purchase/lib/_db_deps.ts +77 -0
- package/src/modules/purchase/lib/domain.ts +467 -0
- package/src/modules/purchase/lib/errors.generated.ts +367 -0
- package/src/modules/purchase/lib/permissions.generated.ts +34 -0
- package/src/modules/purchase/lib/types.ts +65 -0
- package/src/modules/purchase/module.ts +218 -0
- package/src/modules/purchase/permissions.ts +1 -0
- package/src/modules/purchase/query/.gitkeep +0 -0
- package/src/modules/purchase/query/calculatePurchaseBillDueSchedule.generated.ts +5 -0
- package/src/modules/purchase/query/calculatePurchaseBillDueSchedule.test.ts +183 -0
- package/src/modules/purchase/query/calculatePurchaseBillDueSchedule.ts +41 -0
- package/src/modules/purchase/query/calculatePurchasePrice.generated.ts +5 -0
- package/src/modules/purchase/query/calculatePurchasePrice.test.ts +143 -0
- package/src/modules/purchase/query/calculatePurchasePrice.ts +113 -0
- package/src/modules/purchase/query/getGoodsReceipt.generated.ts +5 -0
- package/src/modules/purchase/query/getGoodsReceipt.test.ts +42 -0
- package/src/modules/purchase/query/getGoodsReceipt.ts +27 -0
- package/src/modules/purchase/query/getPurchaseBill.generated.ts +5 -0
- package/src/modules/purchase/query/getPurchaseBill.test.ts +69 -0
- package/src/modules/purchase/query/getPurchaseBill.ts +35 -0
- package/src/modules/purchase/query/getPurchaseOrder.generated.ts +5 -0
- package/src/modules/purchase/query/getPurchaseOrder.test.ts +65 -0
- package/src/modules/purchase/query/getPurchaseOrder.ts +33 -0
- package/src/modules/purchase/query/getPurchasePaymentTerm.generated.ts +5 -0
- package/src/modules/purchase/query/getPurchasePaymentTerm.test.ts +44 -0
- package/src/modules/purchase/query/getPurchasePaymentTerm.ts +30 -0
- package/src/modules/purchase/query/getPurchasePriceList.generated.ts +5 -0
- package/src/modules/purchase/query/getPurchasePriceList.test.ts +48 -0
- package/src/modules/purchase/query/getPurchasePriceList.ts +30 -0
- package/src/modules/purchase/query/getSupplierProfile.generated.ts +5 -0
- package/src/modules/purchase/query/getSupplierProfile.test.ts +50 -0
- package/src/modules/purchase/query/getSupplierProfile.ts +18 -0
- package/src/modules/purchase/tailor.config.ts +13 -0
- package/src/modules/purchase/tailor.d.ts +13 -0
- package/src/modules/purchase/testing/commandTestUtils.ts +35 -0
- package/src/modules/purchase/testing/fixtures.ts +317 -0
- package/src/modules/sales/README.md +69 -0
- package/src/modules/sales/command/.gitkeep +0 -0
- package/src/modules/sales/command/activateChannel.generated.ts +6 -0
- package/src/modules/sales/command/activateChannel.test.ts +70 -0
- package/src/modules/sales/command/activateChannel.ts +48 -0
- package/src/modules/sales/command/activateListing.generated.ts +6 -0
- package/src/modules/sales/command/activateListing.test.ts +87 -0
- package/src/modules/sales/command/activateListing.ts +49 -0
- package/src/modules/sales/command/activateSalesPaymentTerm.generated.ts +6 -0
- package/src/modules/sales/command/activateSalesPaymentTerm.test.ts +58 -0
- package/src/modules/sales/command/activateSalesPaymentTerm.ts +50 -0
- package/src/modules/sales/command/activateSalesPriceList.generated.ts +6 -0
- package/src/modules/sales/command/activateSalesPriceList.test.ts +55 -0
- package/src/modules/sales/command/activateSalesPriceList.ts +46 -0
- package/src/modules/sales/command/activateSalesPriceRule.generated.ts +6 -0
- package/src/modules/sales/command/activateSalesPriceRule.test.ts +83 -0
- package/src/modules/sales/command/activateSalesPriceRule.ts +58 -0
- package/src/modules/sales/command/cancelChannelOrder.generated.ts +6 -0
- package/src/modules/sales/command/cancelChannelOrder.test.ts +47 -0
- package/src/modules/sales/command/cancelChannelOrder.ts +30 -0
- package/src/modules/sales/command/cancelSalesInvoice.generated.ts +6 -0
- package/src/modules/sales/command/cancelSalesInvoice.test.ts +47 -0
- package/src/modules/sales/command/cancelSalesInvoice.ts +37 -0
- package/src/modules/sales/command/cancelSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/cancelSalesOrder.test.ts +70 -0
- package/src/modules/sales/command/cancelSalesOrder.ts +48 -0
- package/src/modules/sales/command/cancelSyncJob.generated.ts +6 -0
- package/src/modules/sales/command/cancelSyncJob.test.ts +58 -0
- package/src/modules/sales/command/cancelSyncJob.ts +30 -0
- package/src/modules/sales/command/closeSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/closeSalesOrder.test.ts +41 -0
- package/src/modules/sales/command/closeSalesOrder.ts +51 -0
- package/src/modules/sales/command/confirmSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/confirmSalesOrder.test.ts +68 -0
- package/src/modules/sales/command/confirmSalesOrder.ts +67 -0
- package/src/modules/sales/command/convertChannelOrder.generated.ts +6 -0
- package/src/modules/sales/command/convertChannelOrder.test.ts +118 -0
- package/src/modules/sales/command/convertChannelOrder.ts +151 -0
- package/src/modules/sales/command/createChannel.generated.ts +6 -0
- package/src/modules/sales/command/createChannel.test.ts +100 -0
- package/src/modules/sales/command/createChannel.ts +58 -0
- package/src/modules/sales/command/createListing.generated.ts +6 -0
- package/src/modules/sales/command/createListing.test.ts +88 -0
- package/src/modules/sales/command/createListing.ts +76 -0
- package/src/modules/sales/command/createSalesCreditNote.generated.ts +6 -0
- package/src/modules/sales/command/createSalesCreditNote.test.ts +56 -0
- package/src/modules/sales/command/createSalesCreditNote.ts +75 -0
- package/src/modules/sales/command/createSalesInvoice.generated.ts +6 -0
- package/src/modules/sales/command/createSalesInvoice.test.ts +85 -0
- package/src/modules/sales/command/createSalesInvoice.ts +94 -0
- package/src/modules/sales/command/createSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/createSalesOrder.test.ts +134 -0
- package/src/modules/sales/command/createSalesOrder.ts +140 -0
- package/src/modules/sales/command/createSalesPaymentTerm.generated.ts +6 -0
- package/src/modules/sales/command/createSalesPaymentTerm.test.ts +59 -0
- package/src/modules/sales/command/createSalesPaymentTerm.ts +50 -0
- package/src/modules/sales/command/createSalesPriceList.generated.ts +6 -0
- package/src/modules/sales/command/createSalesPriceList.test.ts +67 -0
- package/src/modules/sales/command/createSalesPriceList.ts +45 -0
- package/src/modules/sales/command/createSalesPriceRule.generated.ts +6 -0
- package/src/modules/sales/command/createSalesPriceRule.test.ts +137 -0
- package/src/modules/sales/command/createSalesPriceRule.ts +66 -0
- package/src/modules/sales/command/createShipment.generated.ts +6 -0
- package/src/modules/sales/command/createShipment.test.ts +75 -0
- package/src/modules/sales/command/createShipment.ts +86 -0
- package/src/modules/sales/command/deactivateChannel.generated.ts +6 -0
- package/src/modules/sales/command/deactivateChannel.test.ts +29 -0
- package/src/modules/sales/command/deactivateChannel.ts +30 -0
- package/src/modules/sales/command/deactivateSalesPaymentTerm.generated.ts +6 -0
- package/src/modules/sales/command/deactivateSalesPaymentTerm.test.ts +29 -0
- package/src/modules/sales/command/deactivateSalesPaymentTerm.ts +37 -0
- package/src/modules/sales/command/deactivateSalesPriceList.generated.ts +6 -0
- package/src/modules/sales/command/deactivateSalesPriceList.test.ts +33 -0
- package/src/modules/sales/command/deactivateSalesPriceList.ts +37 -0
- package/src/modules/sales/command/deactivateSalesPriceRule.generated.ts +6 -0
- package/src/modules/sales/command/deactivateSalesPriceRule.test.ts +33 -0
- package/src/modules/sales/command/deactivateSalesPriceRule.ts +37 -0
- package/src/modules/sales/command/issueSalesCreditNote.generated.ts +6 -0
- package/src/modules/sales/command/issueSalesCreditNote.test.ts +62 -0
- package/src/modules/sales/command/issueSalesCreditNote.ts +71 -0
- package/src/modules/sales/command/issueSalesInvoice.generated.ts +6 -0
- package/src/modules/sales/command/issueSalesInvoice.test.ts +88 -0
- package/src/modules/sales/command/issueSalesInvoice.ts +115 -0
- package/src/modules/sales/command/markChannelOrderException.generated.ts +6 -0
- package/src/modules/sales/command/markChannelOrderException.test.ts +59 -0
- package/src/modules/sales/command/markChannelOrderException.ts +49 -0
- package/src/modules/sales/command/pauseListing.generated.ts +6 -0
- package/src/modules/sales/command/pauseListing.test.ts +40 -0
- package/src/modules/sales/command/pauseListing.ts +30 -0
- package/src/modules/sales/command/placeSalesOrderOnCreditHold.generated.ts +6 -0
- package/src/modules/sales/command/placeSalesOrderOnCreditHold.test.ts +74 -0
- package/src/modules/sales/command/placeSalesOrderOnCreditHold.ts +46 -0
- package/src/modules/sales/command/postShipment.generated.ts +6 -0
- package/src/modules/sales/command/postShipment.test.ts +97 -0
- package/src/modules/sales/command/postShipment.ts +89 -0
- package/src/modules/sales/command/recordChannelOrder.generated.ts +6 -0
- package/src/modules/sales/command/recordChannelOrder.test.ts +124 -0
- package/src/modules/sales/command/recordChannelOrder.ts +93 -0
- package/src/modules/sales/command/rejectSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/rejectSalesOrder.test.ts +78 -0
- package/src/modules/sales/command/rejectSalesOrder.ts +42 -0
- package/src/modules/sales/command/releaseSalesOrderCreditHold.generated.ts +6 -0
- package/src/modules/sales/command/releaseSalesOrderCreditHold.test.ts +50 -0
- package/src/modules/sales/command/releaseSalesOrderCreditHold.ts +51 -0
- package/src/modules/sales/command/retireListing.generated.ts +6 -0
- package/src/modules/sales/command/retireListing.test.ts +42 -0
- package/src/modules/sales/command/retireListing.ts +30 -0
- package/src/modules/sales/command/retrySyncJob.generated.ts +6 -0
- package/src/modules/sales/command/retrySyncJob.test.ts +54 -0
- package/src/modules/sales/command/retrySyncJob.ts +44 -0
- package/src/modules/sales/command/sendSalesInvoice.generated.ts +6 -0
- package/src/modules/sales/command/sendSalesInvoice.test.ts +50 -0
- package/src/modules/sales/command/sendSalesInvoice.ts +43 -0
- package/src/modules/sales/command/startSyncJob.generated.ts +6 -0
- package/src/modules/sales/command/startSyncJob.test.ts +65 -0
- package/src/modules/sales/command/startSyncJob.ts +54 -0
- package/src/modules/sales/command/submitSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/submitSalesOrder.test.ts +58 -0
- package/src/modules/sales/command/submitSalesOrder.ts +49 -0
- package/src/modules/sales/command/updateChannel.generated.ts +6 -0
- package/src/modules/sales/command/updateChannel.test.ts +71 -0
- package/src/modules/sales/command/updateChannel.ts +68 -0
- package/src/modules/sales/command/updateListing.generated.ts +6 -0
- package/src/modules/sales/command/updateListing.test.ts +56 -0
- package/src/modules/sales/command/updateListing.ts +60 -0
- package/src/modules/sales/command/updateSalesCreditNote.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesCreditNote.test.ts +68 -0
- package/src/modules/sales/command/updateSalesCreditNote.ts +68 -0
- package/src/modules/sales/command/updateSalesInvoice.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesInvoice.test.ts +73 -0
- package/src/modules/sales/command/updateSalesInvoice.ts +80 -0
- package/src/modules/sales/command/updateSalesOrder.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesOrder.test.ts +93 -0
- package/src/modules/sales/command/updateSalesOrder.ts +121 -0
- package/src/modules/sales/command/updateSalesPaymentTerm.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesPaymentTerm.test.ts +66 -0
- package/src/modules/sales/command/updateSalesPaymentTerm.ts +59 -0
- package/src/modules/sales/command/updateSalesPriceList.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesPriceList.test.ts +71 -0
- package/src/modules/sales/command/updateSalesPriceList.ts +52 -0
- package/src/modules/sales/command/updateSalesPriceRule.generated.ts +6 -0
- package/src/modules/sales/command/updateSalesPriceRule.test.ts +95 -0
- package/src/modules/sales/command/updateSalesPriceRule.ts +81 -0
- package/src/modules/sales/command/updateShipment.generated.ts +6 -0
- package/src/modules/sales/command/updateShipment.test.ts +78 -0
- package/src/modules/sales/command/updateShipment.ts +84 -0
- package/src/modules/sales/db/.gitkeep +0 -0
- package/src/modules/sales/db/channel.ts +43 -0
- package/src/modules/sales/db/channelOrder.ts +109 -0
- package/src/modules/sales/db/channelOrderLine.ts +84 -0
- package/src/modules/sales/db/listing.ts +81 -0
- package/src/modules/sales/db/salesCreditNote.ts +63 -0
- package/src/modules/sales/db/salesCreditNoteLine.ts +49 -0
- package/src/modules/sales/db/salesInvoice.ts +95 -0
- package/src/modules/sales/db/salesInvoiceLine.ts +64 -0
- package/src/modules/sales/db/salesOrder.ts +103 -0
- package/src/modules/sales/db/salesOrderLine.ts +82 -0
- package/src/modules/sales/db/salesPaymentTerm.ts +46 -0
- package/src/modules/sales/db/salesPriceList.ts +61 -0
- package/src/modules/sales/db/salesPriceRule.ts +96 -0
- package/src/modules/sales/db/shipment.ts +78 -0
- package/src/modules/sales/db/shipmentLine.ts +58 -0
- package/src/modules/sales/db/syncJob.ts +70 -0
- package/src/modules/sales/docs/commands/ActivateChannel.md +42 -0
- package/src/modules/sales/docs/commands/ActivateListing.md +46 -0
- package/src/modules/sales/docs/commands/ActivateSalesPaymentTerm.md +41 -0
- package/src/modules/sales/docs/commands/ActivateSalesPriceList.md +39 -0
- package/src/modules/sales/docs/commands/ActivateSalesPriceRule.md +48 -0
- package/src/modules/sales/docs/commands/CancelChannelOrder.md +37 -0
- package/src/modules/sales/docs/commands/CancelSalesInvoice.md +39 -0
- package/src/modules/sales/docs/commands/CancelSalesOrder.md +40 -0
- package/src/modules/sales/docs/commands/CancelSyncJob.md +36 -0
- package/src/modules/sales/docs/commands/CloseSalesOrder.md +39 -0
- package/src/modules/sales/docs/commands/ConfirmSalesOrder.md +43 -0
- package/src/modules/sales/docs/commands/ConvertChannelOrder.md +44 -0
- package/src/modules/sales/docs/commands/CreateChannel.md +40 -0
- package/src/modules/sales/docs/commands/CreateListing.md +40 -0
- package/src/modules/sales/docs/commands/CreateSalesCreditNote.md +37 -0
- package/src/modules/sales/docs/commands/CreateSalesInvoice.md +39 -0
- package/src/modules/sales/docs/commands/CreateSalesOrder.md +51 -0
- package/src/modules/sales/docs/commands/CreateSalesPaymentTerm.md +38 -0
- package/src/modules/sales/docs/commands/CreateSalesPriceList.md +37 -0
- package/src/modules/sales/docs/commands/CreateSalesPriceRule.md +46 -0
- package/src/modules/sales/docs/commands/CreateShipment.md +38 -0
- package/src/modules/sales/docs/commands/DeactivateChannel.md +35 -0
- package/src/modules/sales/docs/commands/DeactivateSalesPaymentTerm.md +35 -0
- package/src/modules/sales/docs/commands/DeactivateSalesPriceList.md +35 -0
- package/src/modules/sales/docs/commands/DeactivateSalesPriceRule.md +35 -0
- package/src/modules/sales/docs/commands/IssueSalesCreditNote.md +38 -0
- package/src/modules/sales/docs/commands/IssueSalesInvoice.md +43 -0
- package/src/modules/sales/docs/commands/MarkChannelOrderException.md +37 -0
- package/src/modules/sales/docs/commands/PauseListing.md +36 -0
- package/src/modules/sales/docs/commands/PlaceSalesOrderOnCreditHold.md +41 -0
- package/src/modules/sales/docs/commands/PostShipment.md +41 -0
- package/src/modules/sales/docs/commands/RecordChannelOrder.md +45 -0
- package/src/modules/sales/docs/commands/RejectSalesOrder.md +41 -0
- package/src/modules/sales/docs/commands/ReleaseSalesOrderCreditHold.md +36 -0
- package/src/modules/sales/docs/commands/RetireListing.md +36 -0
- package/src/modules/sales/docs/commands/RetrySyncJob.md +39 -0
- package/src/modules/sales/docs/commands/SendSalesInvoice.md +38 -0
- package/src/modules/sales/docs/commands/StartSyncJob.md +39 -0
- package/src/modules/sales/docs/commands/SubmitSalesOrder.md +43 -0
- package/src/modules/sales/docs/commands/UpdateChannel.md +43 -0
- package/src/modules/sales/docs/commands/UpdateListing.md +38 -0
- package/src/modules/sales/docs/commands/UpdateSalesCreditNote.md +38 -0
- package/src/modules/sales/docs/commands/UpdateSalesInvoice.md +38 -0
- package/src/modules/sales/docs/commands/UpdateSalesOrder.md +45 -0
- package/src/modules/sales/docs/commands/UpdateSalesPaymentTerm.md +41 -0
- package/src/modules/sales/docs/commands/UpdateSalesPriceList.md +40 -0
- package/src/modules/sales/docs/commands/UpdateSalesPriceRule.md +49 -0
- package/src/modules/sales/docs/commands/UpdateShipment.md +38 -0
- package/src/modules/sales/docs/commands/bin/rm.md +52 -0
- package/src/modules/sales/docs/commands/opt/homebrew/bin/codex.md +52 -0
- package/src/modules/sales/docs/commands/opt/homebrew/bin/ps2ps2.md +52 -0
- package/src/modules/sales/docs/commands/opt/homebrew/bin/rg.md +52 -0
- package/src/modules/sales/docs/commands/opt/homebrew/bin/sha384sum.md +52 -0
- package/src/modules/sales/docs/commands/opt/homebrew/opt/libpq/bin/pg_combinebackup.md +52 -0
- package/src/modules/sales/docs/commands/sbin/mount_msdos.md +52 -0
- package/src/modules/sales/docs/commands/sbin/mount_nfs.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/cupstestppd.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/enc2xs.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/hash.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/jarsigner.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/mpsgraphtool.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/nano.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/pod2html5.34.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/ri.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/rs.md +52 -0
- package/src/modules/sales/docs/commands/usr/bin/trustcachectl.md +52 -0
- package/src/modules/sales/docs/commands/usr/sbin/htpasswd.md +52 -0
- package/src/modules/sales/docs/commands/usr/sbin/lpadmin.md +52 -0
- package/src/modules/sales/docs/commands/usr/sbin/setkey.md +52 -0
- package/src/modules/sales/docs/features/channel-listing-management.md +68 -0
- package/src/modules/sales/docs/features/channel-order-sync.md +78 -0
- package/src/modules/sales/docs/features/customer-invoicing.md +89 -0
- package/src/modules/sales/docs/features/customer-sales-pricing.md +72 -0
- package/src/modules/sales/docs/features/sales-order-lifecycle.md +96 -0
- package/src/modules/sales/docs/features/sales-payment-terms.md +67 -0
- package/src/modules/sales/docs/features/shipment-fulfillment.md +71 -0
- package/src/modules/sales/docs/models/Channel.md +48 -0
- package/src/modules/sales/docs/models/ChannelOrder.md +56 -0
- package/src/modules/sales/docs/models/ChannelOrderLine.md +39 -0
- package/src/modules/sales/docs/models/Listing.md +56 -0
- package/src/modules/sales/docs/models/SalesCreditNote.md +47 -0
- package/src/modules/sales/docs/models/SalesCreditNoteLine.md +37 -0
- package/src/modules/sales/docs/models/SalesInvoice.md +55 -0
- package/src/modules/sales/docs/models/SalesInvoiceLine.md +39 -0
- package/src/modules/sales/docs/models/SalesOrder.md +79 -0
- package/src/modules/sales/docs/models/SalesOrderLine.md +42 -0
- package/src/modules/sales/docs/models/SalesPaymentTerm.md +53 -0
- package/src/modules/sales/docs/models/SalesPriceList.md +50 -0
- package/src/modules/sales/docs/models/SalesPriceRule.md +51 -0
- package/src/modules/sales/docs/models/Shipment.md +49 -0
- package/src/modules/sales/docs/models/ShipmentLine.md +38 -0
- package/src/modules/sales/docs/models/SyncJob.md +53 -0
- package/src/modules/sales/docs/queries/CalculateInvoiceDueSchedule.md +37 -0
- package/src/modules/sales/docs/queries/GetApplicableSalesPrice.md +38 -0
- package/src/modules/sales/docs/queries/GetChannel.md +34 -0
- package/src/modules/sales/docs/queries/GetChannelOrder.md +34 -0
- package/src/modules/sales/docs/queries/GetListing.md +34 -0
- package/src/modules/sales/docs/queries/GetListingByExternalIdentifier.md +35 -0
- package/src/modules/sales/docs/queries/GetSalesCreditNote.md +34 -0
- package/src/modules/sales/docs/queries/GetSalesInvoice.md +34 -0
- package/src/modules/sales/docs/queries/GetSalesOrder.md +36 -0
- package/src/modules/sales/docs/queries/GetSalesPaymentTerm.md +34 -0
- package/src/modules/sales/docs/queries/GetSalesPriceList.md +34 -0
- package/src/modules/sales/docs/queries/GetShipment.md +34 -0
- package/src/modules/sales/docs/queries/GetSyncJob.md +34 -0
- package/src/modules/sales/docs/queries/ListChannelOrdersByStatus.md +34 -0
- package/src/modules/sales/docs/queries/ListChannels.md +33 -0
- package/src/modules/sales/docs/queries/ListListingsByChannel.md +33 -0
- package/src/modules/sales/docs/queries/ListSalesCreditNotesByInvoice.md +33 -0
- package/src/modules/sales/docs/queries/ListSalesInvoicesBySalesOrder.md +33 -0
- package/src/modules/sales/docs/queries/ListSalesOrders.md +36 -0
- package/src/modules/sales/docs/queries/ListSalesPaymentTerms.md +33 -0
- package/src/modules/sales/docs/queries/ListSalesPriceLists.md +33 -0
- package/src/modules/sales/docs/queries/ListSalesPriceRulesByPriceList.md +33 -0
- package/src/modules/sales/docs/queries/ListShipmentsBySalesOrder.md +33 -0
- package/src/modules/sales/docs/queries/ListSyncJobs.md +34 -0
- package/src/modules/sales/executor/.gitkeep +0 -0
- package/src/modules/sales/generated/.gitkeep +0 -0
- package/src/modules/sales/generated/enums.ts +119 -0
- package/src/modules/sales/generated/kysely-tailordb.ts +332 -0
- package/src/modules/sales/index.ts +2 -0
- package/src/modules/sales/lib/_db_deps.ts +67 -0
- package/src/modules/sales/lib/domain.ts +354 -0
- package/src/modules/sales/lib/errors.generated.ts +417 -0
- package/src/modules/sales/lib/permissions.generated.ts +53 -0
- package/src/modules/sales/lib/repository.ts +137 -0
- package/src/modules/sales/lib/types.ts +105 -0
- package/src/modules/sales/module.ts +418 -0
- package/src/modules/sales/permissions.ts +3 -0
- package/src/modules/sales/query/.gitkeep +0 -0
- package/src/modules/sales/query/calculateInvoiceDueSchedule.generated.ts +5 -0
- package/src/modules/sales/query/calculateInvoiceDueSchedule.test.ts +107 -0
- package/src/modules/sales/query/calculateInvoiceDueSchedule.ts +35 -0
- package/src/modules/sales/query/getApplicableSalesPrice.generated.ts +5 -0
- package/src/modules/sales/query/getApplicableSalesPrice.test.ts +110 -0
- package/src/modules/sales/query/getApplicableSalesPrice.ts +81 -0
- package/src/modules/sales/query/getChannel.generated.ts +5 -0
- package/src/modules/sales/query/getChannel.test.ts +39 -0
- package/src/modules/sales/query/getChannel.ts +15 -0
- package/src/modules/sales/query/getChannelOrder.generated.ts +5 -0
- package/src/modules/sales/query/getChannelOrder.test.ts +50 -0
- package/src/modules/sales/query/getChannelOrder.ts +29 -0
- package/src/modules/sales/query/getListing.generated.ts +5 -0
- package/src/modules/sales/query/getListing.test.ts +39 -0
- package/src/modules/sales/query/getListing.ts +15 -0
- package/src/modules/sales/query/getListingByExternalIdentifier.generated.ts +5 -0
- package/src/modules/sales/query/getListingByExternalIdentifier.test.ts +61 -0
- package/src/modules/sales/query/getListingByExternalIdentifier.ts +23 -0
- package/src/modules/sales/query/getSalesCreditNote.generated.ts +5 -0
- package/src/modules/sales/query/getSalesCreditNote.test.ts +44 -0
- package/src/modules/sales/query/getSalesCreditNote.ts +14 -0
- package/src/modules/sales/query/getSalesInvoice.generated.ts +5 -0
- package/src/modules/sales/query/getSalesInvoice.test.ts +44 -0
- package/src/modules/sales/query/getSalesInvoice.ts +14 -0
- package/src/modules/sales/query/getSalesOrder.generated.ts +5 -0
- package/src/modules/sales/query/getSalesOrder.test.ts +57 -0
- package/src/modules/sales/query/getSalesOrder.ts +20 -0
- package/src/modules/sales/query/getSalesPaymentTerm.generated.ts +5 -0
- package/src/modules/sales/query/getSalesPaymentTerm.test.ts +44 -0
- package/src/modules/sales/query/getSalesPaymentTerm.ts +24 -0
- package/src/modules/sales/query/getSalesPriceList.generated.ts +5 -0
- package/src/modules/sales/query/getSalesPriceList.test.ts +39 -0
- package/src/modules/sales/query/getSalesPriceList.ts +15 -0
- package/src/modules/sales/query/getShipment.generated.ts +5 -0
- package/src/modules/sales/query/getShipment.test.ts +44 -0
- package/src/modules/sales/query/getShipment.ts +12 -0
- package/src/modules/sales/query/getSyncJob.generated.ts +5 -0
- package/src/modules/sales/query/getSyncJob.test.ts +43 -0
- package/src/modules/sales/query/getSyncJob.ts +24 -0
- package/src/modules/sales/query/listChannelOrdersByStatus.generated.ts +5 -0
- package/src/modules/sales/query/listChannelOrdersByStatus.test.ts +58 -0
- package/src/modules/sales/query/listChannelOrdersByStatus.ts +53 -0
- package/src/modules/sales/query/listChannels.generated.ts +5 -0
- package/src/modules/sales/query/listChannels.test.ts +36 -0
- package/src/modules/sales/query/listChannels.ts +39 -0
- package/src/modules/sales/query/listListingsByChannel.generated.ts +5 -0
- package/src/modules/sales/query/listListingsByChannel.test.ts +36 -0
- package/src/modules/sales/query/listListingsByChannel.ts +39 -0
- package/src/modules/sales/query/listSalesCreditNotesByInvoice.generated.ts +5 -0
- package/src/modules/sales/query/listSalesCreditNotesByInvoice.test.ts +36 -0
- package/src/modules/sales/query/listSalesCreditNotesByInvoice.ts +42 -0
- package/src/modules/sales/query/listSalesInvoicesBySalesOrder.generated.ts +5 -0
- package/src/modules/sales/query/listSalesInvoicesBySalesOrder.test.ts +36 -0
- package/src/modules/sales/query/listSalesInvoicesBySalesOrder.ts +42 -0
- package/src/modules/sales/query/listSalesOrders.generated.ts +5 -0
- package/src/modules/sales/query/listSalesOrders.test.ts +79 -0
- package/src/modules/sales/query/listSalesOrders.ts +67 -0
- package/src/modules/sales/query/listSalesPaymentTerms.generated.ts +5 -0
- package/src/modules/sales/query/listSalesPaymentTerms.test.ts +36 -0
- package/src/modules/sales/query/listSalesPaymentTerms.ts +42 -0
- package/src/modules/sales/query/listSalesPriceLists.generated.ts +5 -0
- package/src/modules/sales/query/listSalesPriceLists.test.ts +36 -0
- package/src/modules/sales/query/listSalesPriceLists.ts +39 -0
- package/src/modules/sales/query/listSalesPriceRulesByPriceList.generated.ts +5 -0
- package/src/modules/sales/query/listSalesPriceRulesByPriceList.test.ts +39 -0
- package/src/modules/sales/query/listSalesPriceRulesByPriceList.ts +47 -0
- package/src/modules/sales/query/listShipmentsBySalesOrder.generated.ts +5 -0
- package/src/modules/sales/query/listShipmentsBySalesOrder.test.ts +36 -0
- package/src/modules/sales/query/listShipmentsBySalesOrder.ts +36 -0
- package/src/modules/sales/query/listSyncJobs.generated.ts +5 -0
- package/src/modules/sales/query/listSyncJobs.test.ts +50 -0
- package/src/modules/sales/query/listSyncJobs.ts +47 -0
- package/src/modules/sales/tailor.config.ts +13 -0
- package/src/modules/sales/tailor.d.ts +13 -0
- package/src/modules/sales/testing/commandTestUtils.ts +35 -0
- package/src/modules/sales/testing/fixtures.ts +520 -0
- package/src/modules/user-management/command/.gitkeep +0 -0
- package/src/modules/user-management/command/activateUser.generated.ts +1 -1
- package/src/modules/user-management/command/activateUser.ts +1 -1
- package/src/modules/user-management/command/assignPermissionToRole.generated.ts +1 -1
- package/src/modules/user-management/command/assignPermissionToRole.ts +1 -1
- package/src/modules/user-management/command/assignRoleToUser.generated.ts +1 -1
- package/src/modules/user-management/command/assignRoleToUser.ts +1 -1
- package/src/modules/user-management/command/createPermission.generated.ts +1 -1
- package/src/modules/user-management/command/createPermission.ts +1 -1
- package/src/modules/user-management/command/createRole.generated.ts +1 -1
- package/src/modules/user-management/command/createRole.ts +1 -1
- package/src/modules/user-management/command/createUser.generated.ts +1 -1
- package/src/modules/user-management/command/createUser.ts +1 -1
- package/src/modules/user-management/command/deactivateUser.generated.ts +1 -1
- package/src/modules/user-management/command/deactivateUser.ts +1 -1
- package/src/modules/user-management/command/reactivateUser.generated.ts +1 -1
- package/src/modules/user-management/command/reactivateUser.ts +1 -1
- package/src/modules/user-management/command/revokePermissionFromRole.generated.ts +1 -1
- package/src/modules/user-management/command/revokePermissionFromRole.ts +1 -1
- package/src/modules/user-management/command/revokeRoleFromUser.generated.ts +1 -1
- package/src/modules/user-management/command/revokeRoleFromUser.ts +1 -1
- package/src/modules/user-management/db/.gitkeep +0 -0
- package/src/modules/user-management/executor/.gitkeep +0 -0
- package/src/modules/user-management/generated/.gitkeep +0 -0
- package/src/modules/user-management/lib/errors.generated.ts +1 -6
- package/src/modules/user-management/lib/permissions.generated.ts +1 -1
- package/src/modules/user-management/lib/recomputeUserPermissions.ts +4 -2
- package/src/modules/user-management/lib/types.ts +6 -1
- package/src/modules/user-management/module.ts +1 -1
- package/src/modules/user-management/permissions.ts +3 -0
- package/src/modules/user-management/query/.gitkeep +0 -0
- package/src/modules/user-management/query/listRolePermissionsByRole.generated.ts +5 -0
- package/src/modules/user-management/query/listRolePermissionsByRole.test.ts +20 -0
- package/src/modules/user-management/query/listRolePermissionsByRole.ts +28 -0
- package/src/modules/user-management/query/listUserRolesByUser.generated.ts +5 -0
- package/src/modules/user-management/query/listUserRolesByUser.test.ts +20 -0
- package/src/modules/user-management/query/listUserRolesByUser.ts +28 -0
- package/src/schemas.ts +6 -6
- package/src/shared/defineCommand.ts +1 -1
- package/src/shared/entityTypes.ts +1 -1
- package/src/shared/uuidv5.test.ts +18 -0
- package/src/shared/uuidv5.ts +23 -0
- package/src/testing/index.ts +1 -1
- package/templates/scaffold/app/backend/package.json +1 -3
- package/templates/scaffold/app/backend/seed/exec.mjs +7 -5
- package/templates/scaffold/app/backend/src/generated/kysely-tailordb.ts +0 -11
- package/templates/scaffold/module/lib/types.ts +6 -1
- package/templates/scaffold/module/permissions.ts +1 -1
- package/templates/scaffold/module/seed/index.ts +19 -0
- package/src/modules/business-partner/lib/errors.ts +0 -2
- package/src/modules/organization/lib/errors.ts +0 -1
- package/templates/scaffold/module/lib/errors.ts +0 -1
- /package/schemas/{app-compose → app}/actors.yml +0 -0
- /package/schemas/{app-compose → app}/business-flow.yml +0 -0
- /package/schemas/{app-compose → app}/requirements.yml +0 -0
- /package/schemas/{app-compose → app}/resolver.yml +0 -0
- /package/schemas/{app-compose → app}/screen.yml +0 -0
- /package/schemas/{app-compose → app}/story.yml +0 -0
- /package/src/modules/{purchase → inventory/command}/.gitkeep +0 -0
- /package/src/modules/{audit/lib/errors.ts → inventory/db/.gitkeep} +0 -0
- /package/src/modules/{coa-management/lib/errors.ts → inventory/executor/.gitkeep} +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Supplier Bill Matching
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Supplier Bill Matching captures supplier invoices as `PurchaseBill` documents and validates them against the commercial and fulfillment evidence already recorded in purchase. Each bill line references one or more purchase order lines and, when 3-way matching is required, the posted goods receipts that prove quantity has actually been received. The result is a procurement-side decision: is this supplier invoice commercially acceptable, blocked for variance, cancelled before downstream acceptance, or ready for downstream accounts payable?
|
|
6
|
+
|
|
7
|
+
This feature does not post journal entries or execute payment. Its responsibility is to compare what the supplier invoiced with what was ordered and received, detect mismatches, preserve tax and invoice identity required for legal validity, and preserve a clean handoff contract for future AP and accounting modules. The minimum bill lifecycle is `DRAFT` → `BLOCKED` or `MATCHED`, with `CANCELLED` available only before downstream AP handoff acceptance.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Prevent overbilling by ensuring supplier invoices align with ordered and received quantities
|
|
12
|
+
- Detect price variances between purchase order commitments and supplier invoice lines
|
|
13
|
+
- Support both 2-way matching (order to invoice) and 3-way matching (order, receipt, invoice)
|
|
14
|
+
- Provide a clear blocked-versus-ready status before bills reach downstream accounts-payable workflows
|
|
15
|
+
- Allow matched or blocked bills to be cancelled while they are still owned by purchase and have not yet been accepted by downstream AP
|
|
16
|
+
- Carry supplier invoice identity, payment-term snapshot, and due-date schedule into payable processing
|
|
17
|
+
- Capture supplier tax identifiers, tax codes, and tax amounts needed by downstream AP validation
|
|
18
|
+
- Preserve an auditable link between invoice lines, purchase orders, and receipts
|
|
19
|
+
|
|
20
|
+
## Process Flow
|
|
21
|
+
|
|
22
|
+
```mermaid
|
|
23
|
+
flowchart TD
|
|
24
|
+
A[Create Purchase Bill] --> B[Enter supplier invoice reference and lines]
|
|
25
|
+
B --> C[Match bill lines to PO lines]
|
|
26
|
+
C --> D{Matching mode?}
|
|
27
|
+
D -->|2-way| E[Compare invoice to ordered qty and price]
|
|
28
|
+
D -->|3-way| F[Compare invoice to ordered qty, price, and posted receipts]
|
|
29
|
+
E --> G{Within tolerance?}
|
|
30
|
+
F --> G
|
|
31
|
+
G -->|No| H[BLOCKED FOR VARIANCE]
|
|
32
|
+
G -->|Yes| I[MATCHED]
|
|
33
|
+
I --> J[Calculate due schedule from payment term]
|
|
34
|
+
J --> K[Ready for downstream AP or accounting handoff]
|
|
35
|
+
H --> L{Cancel before AP handoff?}
|
|
36
|
+
I --> L
|
|
37
|
+
L -->|Yes| M[CANCELLED]
|
|
38
|
+
L -->|No| J
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Scenario Patterns
|
|
42
|
+
|
|
43
|
+
- **Perfect 3-way match**: The supplier invoice arrives after the goods receipt, and billed quantities and prices match the purchase order exactly, so the bill is marked ready
|
|
44
|
+
- **Price variance within tolerance**: The supplier invoice price differs slightly from the ordered price due to exchange rounding or minor surcharge, and the configured tolerance allows the bill through
|
|
45
|
+
- **Quantity variance blocked**: The supplier invoices 100 units, but only 80 have been received under a 3-way match policy, so the bill is blocked pending additional receipt or correction
|
|
46
|
+
- **2-way matching for non-stock procurement**: A service purchase is matched only against the purchase order because warehouse receipt proof is not required by policy
|
|
47
|
+
- **Duplicate invoice prevention**: The same supplier invoice number is entered twice for one company and supplier, and the second attempt is rejected
|
|
48
|
+
- **Partial billing**: The supplier bills only the first shipment of a larger order; the matched quantity is recorded and the order remains open for later bills
|
|
49
|
+
- **Pre-AP cancellation**: A matched bill is discovered to contain the wrong supplier invoice reference before AP accepts it, so procurement cancels the bill and preserves the original comparison evidence
|
|
50
|
+
- **Credit or correction workflow precursor**: A supplier invoice is overbilled and blocked or cancelled, creating the basis for a future thin `PurchaseCreditNote` or bill-revision workflow without redesigning the `PurchaseBill` state machine
|
|
51
|
+
- **Payment-term inheritance**: The bill inherits the order's negotiated payment term so downstream AP sees the correct due dates and discount window
|
|
52
|
+
- **Tax snapshot capture**: The bill snapshots supplier tax identification, tax code, taxable amount, and tax amount so legal invoice validation survives later supplier-master edits
|
|
53
|
+
|
|
54
|
+
## Test Cases
|
|
55
|
+
|
|
56
|
+
- Creating a purchase bill with a valid supplier, company, and at least one bill line should succeed
|
|
57
|
+
- A purchase bill line must reference a valid purchase order line and a billed quantity greater than zero
|
|
58
|
+
- Duplicate supplier invoice numbers for the same supplier and company should be rejected
|
|
59
|
+
- A 2-way matched bill must compare billed quantity and price to the referenced purchase order line
|
|
60
|
+
- A 3-way matched bill must not approve a billed quantity greater than the cumulative posted receipt quantity, subject to configured tolerance
|
|
61
|
+
- A bill with a price variance above configured tolerance should be marked blocked rather than matched
|
|
62
|
+
- A bill matched to a cancelled purchase order should fail
|
|
63
|
+
- A matched bill must snapshot the supplier invoice date, external invoice number, ordered price reference, assigned payment term, supplier tax identifier, tax code, taxable amount, and tax amount
|
|
64
|
+
- Partial billing must increase the purchase order line billed quantity without forcing the order closed
|
|
65
|
+
- A supplier bill must not be considered ready for downstream AP until all required matching checks pass
|
|
66
|
+
- A matched or blocked bill may transition to `CANCELLED` only while no downstream AP or accounting module has accepted the payable handoff
|
|
67
|
+
- Cancelling a bill must preserve the original variance evidence and line references for future credit-note or dispute workflows
|
|
68
|
+
- Bills must be isolated by company and must not reference purchase orders from another company
|
|
69
|
+
- If a bill is blocked for variance, the variance reason and comparison basis should remain visible for review
|
|
70
|
+
- Matching logic must preserve whether the bill used 2-way or 3-way matching
|
|
71
|
+
- Only authorized procurement or AP users should be able to match, block, or release supplier bills
|
|
72
|
+
- A matched bill should expose the due-date schedule calculated from the assigned purchase payment term
|
|
73
|
+
- Editing supplier price rules after bill creation must not change the comparison baseline for an existing matched or blocked bill
|
|
74
|
+
|
|
75
|
+
## Reference Links
|
|
76
|
+
|
|
77
|
+
- [Odoo vendor bills and three-way matching](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/purchase/manage_deals/manage.html#vendor-bills)
|
|
78
|
+
- [Oracle invoice matching overview](https://docs.oracle.com/en/cloud/saas/financials/24c/fappp/invoice-matching.html)
|
|
79
|
+
- [SAP supplier invoice and invoice verification documentation](https://help.sap.com/docs/SAP_S4HANA_CLOUD)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Supplier Purchase Pricing
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Supplier Purchase Pricing manages the supplier-specific commercial rules that default onto purchase order lines. A `PurchasePriceList` groups one supplier's purchasable pricing conditions, while `PurchasePriceRule` defines the actual pricing logic for a given item or purchasing context, such as effective date, minimum quantity, currency, and unit of measure. These rules allow procurement teams to keep negotiated purchase prices in a structured, reusable form instead of entering them manually on every order.
|
|
6
|
+
|
|
7
|
+
The feature is intentionally procurement-specific rather than generic enterprise pricing. It focuses on "what do we expect to pay this supplier for this item under these conditions?" and provides deterministic price selection when buyers create or revise purchase orders. When the supplier's purchasing unit of measure differs from the item's stocking unit, this feature relies on conversion definitions owned by `primitives` rather than re-implementing unit-conversion logic in purchase. Blanket orders and release-against-contract pricing remain explicit non-goals for the MVP.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Reduce manual entry by defaulting supplier-negotiated prices into purchase order lines
|
|
12
|
+
- Capture quantity breaks, date validity, and currency-specific supplier agreements
|
|
13
|
+
- Preserve commercial history by snapshotting the applied rule onto the purchase order at ordering time
|
|
14
|
+
- Support consistent purchasing across buyers, companies, and repeated replenishment cycles
|
|
15
|
+
- Make price variance detection possible when supplier bills arrive above or below the agreed purchase condition
|
|
16
|
+
- Separate procurement pricing from product definition and from downstream AP settlement logic
|
|
17
|
+
- Keep purchasing-UoM pricing compatible with stock-UoM receiving by delegating conversions to the shared unit-conversion capability
|
|
18
|
+
|
|
19
|
+
## Process Flow
|
|
20
|
+
|
|
21
|
+
```mermaid
|
|
22
|
+
flowchart TD
|
|
23
|
+
A[Create Purchase Price List] --> B[Add Purchase Price Rules]
|
|
24
|
+
B --> C[Set supplier, item scope, dates, quantity breaks]
|
|
25
|
+
C --> D[Activate list]
|
|
26
|
+
D --> E[Buyer creates PO line]
|
|
27
|
+
E --> F[Resolve applicable rules]
|
|
28
|
+
F --> G{Rule found?}
|
|
29
|
+
G -->|Yes| H[Apply best matching rule]
|
|
30
|
+
G -->|No| I[Manual price entry]
|
|
31
|
+
H --> J[Snapshot applied price and rule reference on PO line]
|
|
32
|
+
I --> J
|
|
33
|
+
J --> K[Order placed]
|
|
34
|
+
K --> L[Supplier bill matching compares invoice price to ordered price]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Scenario Patterns
|
|
38
|
+
|
|
39
|
+
- **Annual supplier contract**: A supplier price list is created for the fiscal year with negotiated base prices for each frequently purchased item
|
|
40
|
+
- **Quantity break pricing**: A supplier offers 10 currency per unit above 100 pieces and 9 currency per unit above 500 pieces; the applicable tier is selected automatically based on ordered quantity
|
|
41
|
+
- **Time-bounded promotion**: A temporary supplier discount is valid for one month. Orders placed within the effective range receive the temporary price, after which the normal rule applies again
|
|
42
|
+
- **Multi-currency purchasing**: The same supplier provides one item in USD and another in EUR; purchase price rules keep those commercial conditions separate and explicit
|
|
43
|
+
- **Supplier-specific UoM**: A supplier sells an item by carton while the item's internal base unit is piece; the purchase price rule is keyed to the purchasing UoM used on the PO
|
|
44
|
+
- **UoM conversion delegation**: A buyer orders in cartons while inventory receives in pieces. The purchase rule prices the carton, and purchase calls the shared unit-conversion definitions from `primitives` to derive receipt and variance comparisons consistently
|
|
45
|
+
- **One-time exception**: The system defaults the contracted price, but the buyer manually overrides it for a special order while retaining the original matched-rule reference for auditability
|
|
46
|
+
- **Rule retirement**: An old price list is deactivated when a new contract begins, preventing future orders from using obsolete supplier pricing
|
|
47
|
+
- **Price variance review**: The supplier invoice arrives above the ordered unit price, and the matched purchase price rule helps determine whether the variance is expected or should be blocked
|
|
48
|
+
|
|
49
|
+
## Test Cases
|
|
50
|
+
|
|
51
|
+
- Creating a purchase price list for an ACTIVE supplier with the SUPPLIER role should succeed
|
|
52
|
+
- A purchase price rule must require a positive unit price and a valid item or defined pricing scope
|
|
53
|
+
- A quantity-break rule must not allow a negative minimum quantity
|
|
54
|
+
- A rule with an effective end date earlier than its start date should fail validation
|
|
55
|
+
- Inactive price lists or inactive rules must not be selected for new purchase orders
|
|
56
|
+
- When multiple rules match the same PO line, rule resolution must follow deterministic precedence based on supplier, item scope, UoM, minimum quantity, date, and explicit priority
|
|
57
|
+
- When no rule matches a PO line, the system should allow manual pricing while marking the line as unmatched to a price rule
|
|
58
|
+
- Editing a price rule after a purchase order is placed must not retroactively change the ordered unit price on that existing order
|
|
59
|
+
- A purchase price list must be isolated by company when company-specific procurement data is required
|
|
60
|
+
- Duplicate rules with indistinguishable precedence for the same supplier, item, date, and quantity context should be rejected or warned
|
|
61
|
+
- A purchase price rule currency must reference a valid currency from the primitives module
|
|
62
|
+
- If a purchase price rule UoM differs from the item's stocking UoM, a valid conversion path from `primitives` must exist before the rule can be used operationally
|
|
63
|
+
- Only ACTIVE items should be assignable to newly created purchase price rules
|
|
64
|
+
- A buyer should be able to override a defaulted price on a draft order while retaining audit information about the default rule
|
|
65
|
+
- Supplier bill matching should be able to compare invoice price against the purchase order's snapshotted price even if the underlying rule is later deactivated
|
|
66
|
+
- Only authorized procurement users should be able to create, update, activate, or deactivate purchase price lists
|
|
67
|
+
|
|
68
|
+
## Reference Links
|
|
69
|
+
|
|
70
|
+
- [Odoo vendor price and blanket-order purchasing concepts](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/purchase/manage_deals.html)
|
|
71
|
+
- [Oracle Fusion Cloud Procurement documentation](https://docs.oracle.com/en/cloud/saas/procurement/index.html)
|
|
72
|
+
- [SAP S/4HANA Cloud procurement documentation](https://help.sap.com/docs/SAP_S4HANA_CLOUD)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# GoodsReceipt
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
GoodsReceipt is the purchase-side confirmation that ordered goods or services were received from the supplier. It records one receipt event against one purchase order with one or more receipt lines, updates purchase-order receiving progress, and optionally emits a downstream inventory handoff for stock items.
|
|
6
|
+
|
|
7
|
+
The model intentionally separates procurement confirmation from warehouse execution. Purchase owns the fact that the supplier fulfilled part of the commitment; inventory owns the resulting stock movement and physical storage consequences.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Draft: createGoodsReceipt
|
|
20
|
+
Draft --> Draft: updateGoodsReceipt
|
|
21
|
+
Draft --> Posted: postGoodsReceipt
|
|
22
|
+
Draft --> Cancelled: cancelGoodsReceipt
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Command Definitions
|
|
26
|
+
|
|
27
|
+
- [createGoodsReceipt](../commands/CreateGoodsReceipt.md) - Create a draft receipt against open purchase-order lines
|
|
28
|
+
- [updateGoodsReceipt](../commands/UpdateGoodsReceipt.md) - Correct draft receipt quantities, dates, or line composition before posting
|
|
29
|
+
- [postGoodsReceipt](../commands/PostGoodsReceipt.md) - Validate tolerance, post the receipt, update order progress, and emit the inbound handoff
|
|
30
|
+
- [cancelGoodsReceipt](../commands/CancelGoodsReceipt.md) - Cancel a draft receipt before it affects purchase-order fulfillment
|
|
31
|
+
|
|
32
|
+
### Query Definitions
|
|
33
|
+
|
|
34
|
+
- [getGoodsReceipt](../queries/GetGoodsReceipt.md) - Retrieve a goods receipt with all receipt lines and handoff metadata
|
|
35
|
+
|
|
36
|
+
### Models
|
|
37
|
+
|
|
38
|
+
- GoodsReceipt
|
|
39
|
+
- GoodsReceiptLine
|
|
40
|
+
- InboundReceiptHandoff
|
|
41
|
+
|
|
42
|
+
### Invariants
|
|
43
|
+
|
|
44
|
+
- Every goods receipt belongs to exactly one company, one supplier, and one purchase order
|
|
45
|
+
- Every receipt line references one open purchase-order line and records a received quantity greater than zero
|
|
46
|
+
- Only `POSTED` receipts contribute to purchase-order received quantities and 3-way bill matching
|
|
47
|
+
- A receipt cannot post against a cancelled or closed purchase order
|
|
48
|
+
- Over-receipt beyond configured tolerance is invalid unless an explicit override path is recorded by policy
|
|
49
|
+
- Service or non-stock receipt lines do not require downstream warehouse execution even when the procurement receipt is posted
|
|
50
|
+
- Posted receipts are immutable; future corrections must use a compensating workflow instead of mutating receipt history in place
|
|
51
|
+
- The minimum `InboundReceiptHandoff` payload contains purchase-order reference, purchase-order-line reference, goods-receipt reference, received quantity, unit of measure, receipt date, destination site, and destination storage location when stock execution requires it
|
|
52
|
+
|
|
53
|
+
### Relationships
|
|
54
|
+
|
|
55
|
+
- **Belongs To PurchaseOrder**: Each receipt posts against one [PurchaseOrder](./PurchaseOrder.md)
|
|
56
|
+
- **Has Many GoodsReceiptLines**: Each receipt contains one or more line-level receipt confirmations
|
|
57
|
+
- **References Item**: Receipt lines trace back to one [Item](../../../item-management/docs/models/Item.md) through the purchase-order line
|
|
58
|
+
- **May Emit InboundReceiptHandoff**: Posted stock receipts hand off to inventory execution using [CreateStockMovement](../../../inventory/docs/commands/CreateStockMovement.md) or an equivalent downstream adapter
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# PurchaseBill
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
PurchaseBill captures a supplier invoice inside the purchase domain until procurement matching is complete. It compares supplier-invoiced quantities, prices, and tax information against purchase-order commitments and, when required, posted goods receipts. The bill is then marked matched, blocked for variance, or cancelled before downstream AP acceptance.
|
|
6
|
+
|
|
7
|
+
The purchase bill also owns the procurement-side payable readiness contract. Once a bill is matched, purchase can hand downstream modules a stable `BillReadyHandoff` payload containing the invoice identity, matched amounts, due schedule, and tax snapshot.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Draft: createPurchaseBill
|
|
20
|
+
Draft --> Draft: updatePurchaseBill
|
|
21
|
+
Draft --> Blocked: matchPurchaseBill
|
|
22
|
+
Draft --> Matched: matchPurchaseBill
|
|
23
|
+
Blocked --> Matched: releasePurchaseBill
|
|
24
|
+
Draft --> Cancelled: cancelPurchaseBill
|
|
25
|
+
Blocked --> Cancelled: cancelPurchaseBill
|
|
26
|
+
Matched --> Cancelled: cancelPurchaseBill
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Command Definitions
|
|
30
|
+
|
|
31
|
+
- [createPurchaseBill](../commands/CreatePurchaseBill.md) - Create a draft supplier bill with invoice identity and line references
|
|
32
|
+
- [updatePurchaseBill](../commands/UpdatePurchaseBill.md) - Revise a draft bill before procurement matching is finalized
|
|
33
|
+
- [matchPurchaseBill](../commands/MatchPurchaseBill.md) - Run 2-way or 3-way matching and set the bill to matched or blocked
|
|
34
|
+
- [releasePurchaseBill](../commands/ReleasePurchaseBill.md) - Move a blocked bill to matched after authorized variance resolution
|
|
35
|
+
- [cancelPurchaseBill](../commands/CancelPurchaseBill.md) - Cancel a draft, blocked, or matched bill before downstream AP accepts the handoff
|
|
36
|
+
|
|
37
|
+
### Query Definitions
|
|
38
|
+
|
|
39
|
+
- [getPurchaseBill](../queries/GetPurchaseBill.md) - Retrieve a supplier bill with matching results, snapshots, and line references
|
|
40
|
+
- [calculatePurchaseBillDueSchedule](../queries/CalculatePurchaseBillDueSchedule.md) - Compute the downstream payable schedule from the bill's payment-term snapshot
|
|
41
|
+
|
|
42
|
+
### Models
|
|
43
|
+
|
|
44
|
+
- PurchaseBill
|
|
45
|
+
- PurchaseBillLine
|
|
46
|
+
- PurchaseBillTaxSnapshot
|
|
47
|
+
- BillReadyHandoff
|
|
48
|
+
|
|
49
|
+
### Invariants
|
|
50
|
+
|
|
51
|
+
- Every purchase bill belongs to exactly one company and one supplier
|
|
52
|
+
- Supplier invoice number is unique within one company and supplier combination
|
|
53
|
+
- Every bill line references at least one purchase-order line and records billed quantity greater than zero
|
|
54
|
+
- `MATCHED` bills preserve the comparison baseline: invoice date, invoice number, ordered price reference, payment-term snapshot, supplier tax identifier, tax code, taxable amount, and tax amount
|
|
55
|
+
- A 3-way match cannot mark a bill as matched when billed quantity exceeds cumulative posted receipt quantity beyond tolerance
|
|
56
|
+
- `BLOCKED` bills must preserve the variance reason and comparison basis for review
|
|
57
|
+
- `CANCELLED` is allowed only while no downstream AP or accounting module has accepted the `BillReadyHandoff`
|
|
58
|
+
- 4-way matching is explicitly out of scope for this module plan; quality evidence can be added as a future extension without redesigning the bill lifecycle
|
|
59
|
+
- Credit-note and debit-memo workflows are future extensions that must preserve the original bill evidence rather than rewriting it
|
|
60
|
+
|
|
61
|
+
### Relationships
|
|
62
|
+
|
|
63
|
+
- **Belongs To BusinessPartner**: Each bill references one supplier [BusinessPartner](../../../business-partner/docs/models/BusinessPartner.md)
|
|
64
|
+
- **References PurchaseOrder**: Bill lines match against one or more [PurchaseOrder](./PurchaseOrder.md) lines
|
|
65
|
+
- **References GoodsReceipt**: 3-way matching may compare against posted [GoodsReceipt](./GoodsReceipt.md) lines
|
|
66
|
+
- **Snapshots PurchasePaymentTerm**: The bill carries a [PurchasePaymentTerm](./PurchasePaymentTerm.md) snapshot and calculated due schedule
|
|
67
|
+
- **Snapshots PartnerIdentification**: The bill stores supplier tax identity from [PartnerIdentification](../../../business-partner/docs/models/PartnerIdentification.md)
|
|
68
|
+
- **May Emit BillReadyHandoff**: Matched bills hand off invoice reference, matched amounts, due schedule, tax snapshot, and matching mode to downstream AP or accounting
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# PurchaseOrder
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
PurchaseOrder is the commercial procurement document that turns supplier pricing and payment terms into a concrete supplier commitment. It owns the supplier reference, receiving site, ordered lines, agreed unit prices, payment-term snapshot, and the fulfillment progress that later receipts and supplier bills consume.
|
|
6
|
+
|
|
7
|
+
The model combines document-control states with fulfillment states so procurement can answer both questions at once: "has this order been commercially approved?" and "how much of it is still open to receive or bill?"
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Draft: createPurchaseOrder
|
|
20
|
+
Draft --> Draft: updatePurchaseOrder
|
|
21
|
+
Draft --> Submitted: submitPurchaseOrder
|
|
22
|
+
Submitted --> Draft: rejectPurchaseOrder
|
|
23
|
+
Submitted --> Ordered: approvePurchaseOrder
|
|
24
|
+
Draft --> Cancelled: cancelPurchaseOrder
|
|
25
|
+
Submitted --> Cancelled: cancelPurchaseOrder
|
|
26
|
+
Ordered --> Cancelled: cancelPurchaseOrder
|
|
27
|
+
Ordered --> PartiallyReceived: postGoodsReceipt
|
|
28
|
+
Ordered --> Received: postGoodsReceipt
|
|
29
|
+
PartiallyReceived --> PartiallyReceived: postGoodsReceipt
|
|
30
|
+
PartiallyReceived --> Received: postGoodsReceipt
|
|
31
|
+
Ordered --> PartiallyBilled: matchPurchaseBill
|
|
32
|
+
Ordered --> Billed: matchPurchaseBill
|
|
33
|
+
PartiallyReceived --> PartiallyBilled: matchPurchaseBill
|
|
34
|
+
PartiallyReceived --> Billed: matchPurchaseBill
|
|
35
|
+
Received --> PartiallyBilled: matchPurchaseBill
|
|
36
|
+
Received --> Billed: matchPurchaseBill
|
|
37
|
+
PartiallyBilled --> PartiallyBilled: matchPurchaseBill
|
|
38
|
+
PartiallyBilled --> Billed: matchPurchaseBill
|
|
39
|
+
PartiallyReceived --> Closed: closePurchaseOrder
|
|
40
|
+
Received --> Closed: closePurchaseOrder
|
|
41
|
+
PartiallyBilled --> Closed: closePurchaseOrder
|
|
42
|
+
Billed --> Closed: closePurchaseOrder
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Command Definitions
|
|
46
|
+
|
|
47
|
+
- [createPurchaseOrder](../commands/CreatePurchaseOrder.md) - Create a new draft purchase order with one or more lines
|
|
48
|
+
- [updatePurchaseOrder](../commands/UpdatePurchaseOrder.md) - Revise mutable draft commercial fields and line content
|
|
49
|
+
- [submitPurchaseOrder](../commands/SubmitPurchaseOrder.md) - Validate draft completeness and move the order into submitted review
|
|
50
|
+
- [rejectPurchaseOrder](../commands/RejectPurchaseOrder.md) - Return a submitted order to draft with a rejection reason
|
|
51
|
+
- [approvePurchaseOrder](../commands/ApprovePurchaseOrder.md) - Freeze commercial terms and release a submitted order to the supplier
|
|
52
|
+
- [cancelPurchaseOrder](../commands/CancelPurchaseOrder.md) - Cancel an order before downstream fulfillment or billing makes it irreversible
|
|
53
|
+
- [closePurchaseOrder](../commands/ClosePurchaseOrder.md) - Close remaining open quantity after fulfillment or explicit write-off
|
|
54
|
+
- [postGoodsReceipt](../commands/PostGoodsReceipt.md) - Update receipt progress and receiving status from posted goods receipts
|
|
55
|
+
- [matchPurchaseBill](../commands/MatchPurchaseBill.md) - Update billed progress and billing status from matched supplier bills
|
|
56
|
+
|
|
57
|
+
### Query Definitions
|
|
58
|
+
|
|
59
|
+
- [getPurchaseOrder](../queries/GetPurchaseOrder.md) - Retrieve a purchase order with its lines, snapshots, and fulfillment totals
|
|
60
|
+
|
|
61
|
+
### Models
|
|
62
|
+
|
|
63
|
+
- PurchaseOrder
|
|
64
|
+
- PurchaseOrderLine
|
|
65
|
+
- PurchaseOrderPaymentTermSnapshot
|
|
66
|
+
- PurchaseOrderLinePriceSnapshot
|
|
67
|
+
|
|
68
|
+
### Invariants
|
|
69
|
+
|
|
70
|
+
- A purchase order always belongs to exactly one company and one supplier
|
|
71
|
+
- Submitted, ordered, fulfilled, billed, and closed orders must contain at least one line
|
|
72
|
+
- Every line references an active item, has ordered quantity greater than zero, and has a non-negative agreed unit price
|
|
73
|
+
- Lines that require physical receipt must carry a receiving site before the order can leave draft
|
|
74
|
+
- Commercial fields that define the supplier commitment are mutable only while the order is in `DRAFT`
|
|
75
|
+
- The payment term snapshot and ordered unit price snapshot are immutable after the order enters `ORDERED`
|
|
76
|
+
- Cumulative received quantity and cumulative billed quantity cannot be negative and cannot exceed business tolerance rules for the line
|
|
77
|
+
- Cancellation is not allowed once a posted receipt or a matched supplier bill already exists
|
|
78
|
+
- External supplier order reference is unique within one company when provided
|
|
79
|
+
|
|
80
|
+
### Relationships
|
|
81
|
+
|
|
82
|
+
- **Belongs To BusinessPartner**: Each order references one supplier [BusinessPartner](../../../business-partner/docs/models/BusinessPartner.md)
|
|
83
|
+
- **Belongs To Site**: Each order belongs to one receiving [Site](../../../organization/docs/models/Site.md) at document level, with line-level overrides allowed as an extension
|
|
84
|
+
- **Has Many PurchaseOrderLines**: Each order contains one or more commercial commitment lines
|
|
85
|
+
- **Snapshots PurchasePaymentTerm**: The order stores one immutable [PurchasePaymentTerm](./PurchasePaymentTerm.md) snapshot for downstream bill calculation
|
|
86
|
+
- **Snapshots PurchasePriceRule**: Each line may preserve the matched [PurchasePriceRule](./PurchasePriceRule.md) reference and final ordered price
|
|
87
|
+
- **Referenced By GoodsReceipt**: [GoodsReceipt](./GoodsReceipt.md) lines consume open ordered quantity
|
|
88
|
+
- **Referenced By PurchaseBill**: [PurchaseBill](./PurchaseBill.md) lines consume open billed quantity
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# PurchasePaymentTerm
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
PurchasePaymentTerm defines the supplier-facing settlement schedule that purchase orders and supplier bills snapshot for downstream payable processing. A term contains one or more schedule lines that express net-day, end-of-month, fixed-day, installment, and early-payment-discount logic.
|
|
6
|
+
|
|
7
|
+
The model stays inside purchase because it is part of the commercial agreement captured during procurement, but it is designed to hand a stable due schedule to downstream AP without requiring AP to re-interpret supplier contract language.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Active: createPurchasePaymentTerm
|
|
20
|
+
Active --> Inactive: deactivatePurchasePaymentTerm
|
|
21
|
+
Inactive --> Active: activatePurchasePaymentTerm
|
|
22
|
+
Active --> Active: updatePurchasePaymentTerm
|
|
23
|
+
Inactive --> Inactive: updatePurchasePaymentTerm
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Command Definitions
|
|
27
|
+
|
|
28
|
+
- [createPurchasePaymentTerm](../commands/CreatePurchasePaymentTerm.md) - Create a new active supplier payment term with at least one schedule line
|
|
29
|
+
- [updatePurchasePaymentTerm](../commands/UpdatePurchasePaymentTerm.md) - Update the definition of an existing payment term without changing historical snapshots
|
|
30
|
+
- [activatePurchasePaymentTerm](../commands/ActivatePurchasePaymentTerm.md) - Re-enable a deactivated payment term for new procurement documents
|
|
31
|
+
- [deactivatePurchasePaymentTerm](../commands/DeactivatePurchasePaymentTerm.md) - Prevent a payment term from being assigned to new procurement documents
|
|
32
|
+
|
|
33
|
+
### Query Definitions
|
|
34
|
+
|
|
35
|
+
- [getPurchasePaymentTerm](../queries/GetPurchasePaymentTerm.md) - Retrieve a payment term and all of its schedule lines
|
|
36
|
+
- [calculatePurchaseBillDueSchedule](../queries/CalculatePurchaseBillDueSchedule.md) - Convert a payment term plus bill inputs into payable installments and discount windows
|
|
37
|
+
|
|
38
|
+
### Models
|
|
39
|
+
|
|
40
|
+
- PurchasePaymentTerm
|
|
41
|
+
- PurchasePaymentTermLine
|
|
42
|
+
|
|
43
|
+
### Invariants
|
|
44
|
+
|
|
45
|
+
- Every payment term has at least one schedule line
|
|
46
|
+
- Percentage-based installment schedules must total exactly 100 percent before rounding
|
|
47
|
+
- Schedule lines must not contain negative percentage values or negative fixed amounts
|
|
48
|
+
- Early-payment discount dates must occur on or before the final due date generated by the term
|
|
49
|
+
- If a term offers discounting, it must explicitly record whether discount calculation uses `GROSS_AMOUNT` or `NET_AMOUNT`
|
|
50
|
+
- Installment rounding residual is absorbed by the final generated bill schedule line so total scheduled amount always equals the bill amount in transaction currency
|
|
51
|
+
- Inactive payment terms remain valid for historical purchase order and purchase bill snapshots but cannot be assigned to new drafts
|
|
52
|
+
- Exchange-rate conversion is out of scope for payment-term calculation; schedules are computed entirely in the bill transaction currency
|
|
53
|
+
|
|
54
|
+
### Relationships
|
|
55
|
+
|
|
56
|
+
- **Has Many PurchasePaymentTermLines**: Each term contains one or more schedule lines that define due-date and discount behavior
|
|
57
|
+
- **Referenced By SupplierProfile**: A [SupplierProfile](./SupplierProfile.md) may point to one default payment term
|
|
58
|
+
- **Snapshotted By PurchaseOrder**: A [PurchaseOrder](./PurchaseOrder.md) stores the chosen term as an immutable commercial snapshot
|
|
59
|
+
- **Snapshotted By PurchaseBill**: A [PurchaseBill](./PurchaseBill.md) carries the term snapshot forward into downstream payable readiness
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# PurchasePriceList
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
PurchasePriceList groups the supplier-specific purchasing conditions that buyers can reuse across many orders. It defines the commercial container for one supplier in one company, while the actual unit prices, validity windows, and quantity breaks live on child purchase price rules.
|
|
6
|
+
|
|
7
|
+
Separating the list from the rules lets procurement retire an entire negotiated contract or reactivate it later without rewriting historical purchase-order snapshots.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Active: createPurchasePriceList
|
|
20
|
+
Active --> Inactive: deactivatePurchasePriceList
|
|
21
|
+
Inactive --> Active: activatePurchasePriceList
|
|
22
|
+
Active --> Active: updatePurchasePriceList
|
|
23
|
+
Inactive --> Inactive: updatePurchasePriceList
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Command Definitions
|
|
27
|
+
|
|
28
|
+
- [createPurchasePriceList](../commands/CreatePurchasePriceList.md) - Create a new active supplier price list container
|
|
29
|
+
- [updatePurchasePriceList](../commands/UpdatePurchasePriceList.md) - Update descriptive or prioritization fields of an existing price list
|
|
30
|
+
- [activatePurchasePriceList](../commands/ActivatePurchasePriceList.md) - Re-enable a retired supplier contract for new price resolution
|
|
31
|
+
- [deactivatePurchasePriceList](../commands/DeactivatePurchasePriceList.md) - Prevent a price list from participating in future rule resolution
|
|
32
|
+
|
|
33
|
+
### Query Definitions
|
|
34
|
+
|
|
35
|
+
- [getPurchasePriceList](../queries/GetPurchasePriceList.md) - Retrieve a price list with its embedded rules
|
|
36
|
+
- [calculatePurchasePrice](../queries/CalculatePurchasePrice.md) - Resolve the best matching active purchase price rule for a draft order line
|
|
37
|
+
|
|
38
|
+
### Models
|
|
39
|
+
|
|
40
|
+
- PurchasePriceList
|
|
41
|
+
|
|
42
|
+
### Invariants
|
|
43
|
+
|
|
44
|
+
- Every price list belongs to exactly one company and one supplier
|
|
45
|
+
- Only active price lists can participate in automatic purchase price resolution
|
|
46
|
+
- Deactivating a price list does not change purchase orders that already snapshotted one of its rules
|
|
47
|
+
- Price-list priority must be deterministic within one supplier and company so rule resolution can break ties consistently
|
|
48
|
+
|
|
49
|
+
### Relationships
|
|
50
|
+
|
|
51
|
+
- **Belongs To BusinessPartner**: Each list targets one supplier [BusinessPartner](../../../business-partner/docs/models/BusinessPartner.md)
|
|
52
|
+
- **Has Many PurchasePriceRules**: A price list contains one or more [PurchasePriceRule](./PurchasePriceRule.md) records
|
|
53
|
+
- **Referenced By PurchaseOrder**: Draft [PurchaseOrder](./PurchaseOrder.md) lines may default from rules owned by the list before snapshotting the final agreed price
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# PurchasePriceRule
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
PurchasePriceRule defines the exact purchasing condition used to price a draft purchase-order line. A rule can target an item, purchasing unit of measure, transaction currency, validity window, minimum quantity break, and explicit priority, allowing procurement to model annual contracts, temporary promotions, and tiered supplier pricing.
|
|
6
|
+
|
|
7
|
+
The rule lives as an independently managed record because procurement needs to retire, reactivate, or update individual supplier conditions without changing the enclosing contract container.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Active: createPurchasePriceRule
|
|
20
|
+
Active --> Inactive: deactivatePurchasePriceRule
|
|
21
|
+
Inactive --> Active: activatePurchasePriceRule
|
|
22
|
+
Active --> Active: updatePurchasePriceRule
|
|
23
|
+
Inactive --> Inactive: updatePurchasePriceRule
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Command Definitions
|
|
27
|
+
|
|
28
|
+
- [createPurchasePriceRule](../commands/CreatePurchasePriceRule.md) - Add a new active supplier purchase price rule to a list
|
|
29
|
+
- [updatePurchasePriceRule](../commands/UpdatePurchasePriceRule.md) - Update the condition fields of a price rule without changing historical order snapshots
|
|
30
|
+
- [activatePurchasePriceRule](../commands/ActivatePurchasePriceRule.md) - Re-enable a retired rule for future price resolution
|
|
31
|
+
- [deactivatePurchasePriceRule](../commands/DeactivatePurchasePriceRule.md) - Stop a rule from being selected for new draft orders
|
|
32
|
+
|
|
33
|
+
### Query Definitions
|
|
34
|
+
|
|
35
|
+
- [getPurchasePriceList](../queries/GetPurchasePriceList.md) - Retrieve rules through their parent price list
|
|
36
|
+
- [calculatePurchasePrice](../queries/CalculatePurchasePrice.md) - Apply rule precedence and quantity logic to a draft order line
|
|
37
|
+
|
|
38
|
+
### Models
|
|
39
|
+
|
|
40
|
+
- PurchasePriceRule
|
|
41
|
+
|
|
42
|
+
### Invariants
|
|
43
|
+
|
|
44
|
+
- Unit price must be strictly positive
|
|
45
|
+
- Minimum quantity must be zero or greater
|
|
46
|
+
- Effective end date, when provided, must be on or after the effective start date
|
|
47
|
+
- Operational use requires the referenced item, currency, and purchase unit to exist and remain active
|
|
48
|
+
- Rules with indistinguishable precedence for the same supplier, item, date, UoM, currency, and quantity context are invalid because price resolution must always choose a single winner
|
|
49
|
+
- Multi-currency price conversion is out of scope inside purchase pricing; rules are matched only when the requested transaction currency equals the rule currency
|
|
50
|
+
- Purchase orders snapshot the applied rule reference and unit price so later edits or deactivation never rewrite historical commercial terms
|
|
51
|
+
|
|
52
|
+
### Relationships
|
|
53
|
+
|
|
54
|
+
- **Belongs To PurchasePriceList**: Each rule is owned by one [PurchasePriceList](./PurchasePriceList.md)
|
|
55
|
+
- **References Item**: The rule prices one [Item](../../../item-management/docs/models/Item.md) or another explicitly documented purchasing scope
|
|
56
|
+
- **References Currency**: The rule price is denominated in one [Currency](../../../primitives/docs/models/Currency.md)
|
|
57
|
+
- **References Unit**: The rule is keyed to one purchasing [Unit](../../../primitives/docs/models/Unit.md); quantity comparison may require [convertQuantity](../../../primitives/docs/queries/ConvertQuantity.md)
|
|
58
|
+
- **Snapshotted By PurchaseOrderLine**: The final agreed price and matched rule reference are frozen onto [PurchaseOrder](./PurchaseOrder.md) lines
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# SupplierProfile
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
SupplierProfile is the purchase-owned extension of a supplier partner inside one company. It captures procurement defaults that are not part of general business-partner master data, starting with the default purchase payment term used when a new draft purchase order is created for that supplier.
|
|
6
|
+
|
|
7
|
+
This model resolves ownership ambiguity between purchase and business-partner: business-partner owns the partner identity and role classification, while purchase owns supplier-facing procurement defaults keyed by `companyId + supplierPartnerId`.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Standard
|
|
14
|
+
|
|
15
|
+
### Command Definitions
|
|
16
|
+
|
|
17
|
+
- [setSupplierDefaultPurchasePaymentTerm](../commands/SetSupplierDefaultPurchasePaymentTerm.md) - Create or update the supplier procurement profile and assign its default payment term
|
|
18
|
+
|
|
19
|
+
### Query Definitions
|
|
20
|
+
|
|
21
|
+
- [getSupplierProfile](../queries/GetSupplierProfile.md) - Retrieve the company-scoped supplier procurement profile with its default payment term
|
|
22
|
+
|
|
23
|
+
### Models
|
|
24
|
+
|
|
25
|
+
- SupplierProfile
|
|
26
|
+
|
|
27
|
+
### Invariants
|
|
28
|
+
|
|
29
|
+
- A supplier has at most one purchase profile per company
|
|
30
|
+
- A supplier profile can exist only for a partner that has the `SUPPLIER` role
|
|
31
|
+
- A default purchase payment term, when present, must belong to the same company as the supplier profile
|
|
32
|
+
- A deactivated purchase payment term cannot remain the default for new draft purchase orders until it is replaced or cleared
|
|
33
|
+
|
|
34
|
+
### Relationships
|
|
35
|
+
|
|
36
|
+
- **Belongs To BusinessPartner**: Each supplier profile extends one [BusinessPartner](../../../business-partner/docs/models/BusinessPartner.md) record used as the supplier reference
|
|
37
|
+
- **References PurchasePaymentTerm**: The profile may point to one default [PurchasePaymentTerm](./PurchasePaymentTerm.md) for draft order defaulting
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# CalculatePurchaseBillDueSchedule
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
CalculatePurchaseBillDueSchedule converts a purchase payment term plus bill inputs into one or more payable due-schedule lines, including early-payment discount windows when configured.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Accepts a payment-term snapshot or a payment-term id plus bill date and bill amount inputs
|
|
10
|
+
- Installment schedules can mix percentage-based and fixed-amount lines as documented by the term
|
|
11
|
+
- End-of-month logic is calculated from calendar month boundaries, not from a simple day offset
|
|
12
|
+
- Any rounding residual is assigned to the final due-schedule line so the total equals the bill amount in transaction currency
|
|
13
|
+
- Discount calculations explicitly honor the term's `GROSS_AMOUNT` or `NET_AMOUNT` discount base
|
|
14
|
+
- Exchange-rate conversion is out of scope; all results stay in the bill transaction currency
|
|
15
|
+
|
|
16
|
+
## Process Flow
|
|
17
|
+
|
|
18
|
+
```mermaid
|
|
19
|
+
flowchart TD
|
|
20
|
+
A[Receive bill date, amount, and payment term] --> B{Payment term available?}
|
|
21
|
+
B -->|No| C[Return PAYMENT_TERM_NOT_FOUND]
|
|
22
|
+
B -->|Yes| D[Expand term schedule lines]
|
|
23
|
+
D --> E[Calculate due dates using net-day, fixed-day, or end-of-month rules]
|
|
24
|
+
E --> F[Calculate installment amounts and assign residual to final line]
|
|
25
|
+
F --> G[Attach discount metadata where configured]
|
|
26
|
+
G --> H[Return due-schedule lines]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## External Dependencies
|
|
30
|
+
|
|
31
|
+
- None
|
|
32
|
+
|
|
33
|
+
## Error Scenarios
|
|
34
|
+
|
|
35
|
+
- **PAYMENT_TERM_NOT_FOUND**: Referenced purchase payment term does not exist
|
|
36
|
+
- **INVALID_PAYMENT_TERM_CONFIGURATION**: Payment term schedule is incomplete or internally inconsistent
|
|
37
|
+
- **INVALID_BILL_AMOUNT**: Bill amount input is negative or incompatible with the schedule type
|
|
38
|
+
|
|
39
|
+
## Test Cases
|
|
40
|
+
|
|
41
|
+
- calculates a single due date for net-30 terms
|
|
42
|
+
- calculates discount window and final due date for 2/10 net 30
|
|
43
|
+
- calculates multiple due-schedule lines for installment terms
|
|
44
|
+
- applies end-of-month logic correctly
|
|
45
|
+
- assigns rounding residual to the final schedule line
|
|
46
|
+
- returns error when payment term does not exist
|
|
47
|
+
- returns error when payment term configuration is invalid
|