@tailor-platform/erp-kit 0.4.1 → 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 +27 -0
- package/README.md +12 -12
- package/dist/cli.mjs +467 -20
- package/package.json +2 -11
- package/skills/erp-kit-app-2-requirements-review/SKILL.md +2 -2
- package/skills/erp-kit-app-2-requirements-review/references/best-practices-check.md +1 -1
- package/skills/erp-kit-app-3-plan/references/resolver-extraction.md +6 -3
- package/skills/erp-kit-app-4-plan-review/SKILL.md +5 -3
- 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 +12 -3
- package/skills/erp-kit-app-6-impl-frontend/SKILL.md +8 -4
- package/skills/erp-kit-app-7-impl-review/SKILL.md +1 -1
- package/skills/erp-kit-app-shared/references/resolver-classification.md +3 -0
- package/skills/erp-kit-module-2-requirements-review/SKILL.md +3 -30
- 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 +3 -69
- 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/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-seed.ts +69 -0
- package/src/module.ts +56 -0
- package/src/modules/business-partner/README.md +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/.gitkeep +0 -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/executor/.gitkeep +0 -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/docs/models/{item.md → Item.md} +1 -1
- 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/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/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 +0 -5
- package/src/modules/user-management/lib/recomputeUserPermissions.ts +4 -2
- 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/seed/index.ts +19 -0
- /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
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Sales Order Lifecycle
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Sales Order Lifecycle governs how a customer commitment is created, reviewed, confirmed, suspended on commercial hold, fulfilled, invoiced, and closed. A `SalesOrder` records the commercial agreement with a customer for one or more items, including ordered quantity, requested ship timing, unit price, currency, shipping and billing context, payment-term reference, and optional originating channel. The order is the primary document that downstream shipments and invoices reference.
|
|
6
|
+
|
|
7
|
+
The lifecycle tracks both document control and execution progress. A sales order begins in draft, may be submitted for review, can be rejected back to draft with a reason, becomes confirmed when the commercial commitment is accepted, may be moved into `CREDIT_HOLD` when shipment or billing must pause without cancelling the order, and then moves through partial or full shipment and partial or full invoicing states as execution proceeds. This gives sales and operations teams one authoritative record of what is still owed to the customer and what is temporarily blocked for credit or compliance review.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Create a formal, auditable customer commitment before fulfillment or invoicing occurs
|
|
12
|
+
- Freeze commercial terms at order confirmation time even if future price lists or payment terms change
|
|
13
|
+
- Capture customer, channel, billing, and shipping context needed for downstream fulfillment and invoicing
|
|
14
|
+
- Allow a confirmed order to be paused in `CREDIT_HOLD` when credit exposure, compliance review, or dispute handling blocks further execution without voiding the commercial commitment
|
|
15
|
+
- Track ordered quantity, shipped quantity, invoiced quantity, and remaining obligation per line
|
|
16
|
+
- Provide the reference document required for shipment fulfillment and customer invoice generation
|
|
17
|
+
- Support partial fulfillment and partial billing without losing visibility into remaining commitments
|
|
18
|
+
- Prevent inactive customers, inactive items, or incomplete orders from entering downstream execution
|
|
19
|
+
|
|
20
|
+
## Process Flow
|
|
21
|
+
|
|
22
|
+
```mermaid
|
|
23
|
+
flowchart TD
|
|
24
|
+
A[Create Sales Order] --> B[DRAFT]
|
|
25
|
+
B --> C[Add customer, lines, prices, terms]
|
|
26
|
+
C --> D{Submit?}
|
|
27
|
+
D -->|No| C
|
|
28
|
+
D -->|Yes| E[SUBMITTED]
|
|
29
|
+
E --> F{Approve or confirm?}
|
|
30
|
+
F -->|Reject| R[REJECTED]
|
|
31
|
+
R --> B
|
|
32
|
+
F -->|Confirm| G[CONFIRMED]
|
|
33
|
+
G --> H{Place credit hold?}
|
|
34
|
+
H -->|Yes| X[CREDIT_HOLD]
|
|
35
|
+
X --> Y{Release hold?}
|
|
36
|
+
Y -->|Yes| G
|
|
37
|
+
H -->|No| I{Shipment posted?}
|
|
38
|
+
I -->|Partial| J[PARTIALLY SHIPPED]
|
|
39
|
+
I -->|Full| K[SHIPPED]
|
|
40
|
+
J --> L{Invoice issued?}
|
|
41
|
+
K --> L
|
|
42
|
+
L -->|Partial| M[PARTIALLY INVOICED]
|
|
43
|
+
L -->|Full| N[INVOICED]
|
|
44
|
+
J --> O{Close remaining?}
|
|
45
|
+
K --> O
|
|
46
|
+
M --> O
|
|
47
|
+
N --> O
|
|
48
|
+
O -->|Close| Q[CLOSED]
|
|
49
|
+
B --> P[CANCELLED]
|
|
50
|
+
E --> P
|
|
51
|
+
G --> P
|
|
52
|
+
X --> P
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Scenario Patterns
|
|
56
|
+
|
|
57
|
+
- **Direct sales entry**: A sales representative creates an order manually for an existing customer, confirms the commercial terms, and releases it to downstream fulfillment
|
|
58
|
+
- **Channel-originated order**: A marketplace order is normalized into an internal sales order, preserving channel reference and channel-specific commercial context
|
|
59
|
+
- **Rejected for correction**: An approver rejects a submitted order because the shipping address or payment term is wrong, and the order returns to draft with the rejection reason preserved
|
|
60
|
+
- **Partial fulfillment with backorder**: Only some lines ship on time. The order remains open with remaining shippable quantity visible for later shipment
|
|
61
|
+
- **Partial billing**: One shipment is invoiced immediately while the remaining order quantity stays open for later billing
|
|
62
|
+
- **Credit review pause**: A confirmed order exceeds customer credit exposure, so the order moves to `CREDIT_HOLD` until finance releases it without forcing a new order
|
|
63
|
+
- **Manual price override before confirmation**: A user starts from a defaulted price rule but overrides one line before confirmation due to a negotiated exception
|
|
64
|
+
- **Service or non-stock order**: A service line is confirmed and invoiced without warehouse shipment, but the order still tracks billing and closure correctly
|
|
65
|
+
- **Order cancellation before execution**: Demand disappears after submission and the order is cancelled before any shipment or invoice is issued
|
|
66
|
+
- **Close remaining balance**: A customer declines the final backordered units and the user closes the remaining open quantity instead of keeping the order indefinitely active
|
|
67
|
+
|
|
68
|
+
## Test Cases
|
|
69
|
+
|
|
70
|
+
- Creating a sales order with a valid ACTIVE customer, company, and at least one line should succeed
|
|
71
|
+
- A sales order line must require an ACTIVE item, quantity greater than zero, and a non-negative unit price
|
|
72
|
+
- Sales orders can only be created in `DRAFT` status
|
|
73
|
+
- A `DRAFT` order can be revised freely, but confirmed commercial fields must not change without an explicit revision workflow
|
|
74
|
+
- Submitting a sales order without any lines should fail
|
|
75
|
+
- Submitting a sales order without a shipping address when the line requires physical fulfillment should fail
|
|
76
|
+
- Submitting a sales order for a partner that does not carry the CUSTOMER role should fail
|
|
77
|
+
- Confirming a sales order whose customer is INACTIVE should fail
|
|
78
|
+
- Rejecting a submitted sales order should record the rejection reason and return the document to `DRAFT`
|
|
79
|
+
- Moving a confirmed sales order to `CREDIT_HOLD` should require an explicit hold reason and should block new shipment or invoice release actions until the hold is released
|
|
80
|
+
- Releasing `CREDIT_HOLD` should return the order to the last executable confirmed state without losing shipped or invoiced progress already recorded
|
|
81
|
+
- Cancelling a sales order after a posted shipment or issued invoice exists should be prevented unless a controlled downstream reversal flow exists
|
|
82
|
+
- Posting a partial shipment should update line shipped quantities and move the order to a partial shipment status
|
|
83
|
+
- Issuing an invoice should update line invoiced quantities independently of shipment quantities according to billing policy
|
|
84
|
+
- Closing a sales order should be allowed only when all remaining open quantities are fulfilled, cancelled, or explicitly written off
|
|
85
|
+
- Sales order totals and open balances must be isolated per company
|
|
86
|
+
- The applied unit price on a sales order line must remain unchanged even if the underlying sales price rule is later edited
|
|
87
|
+
- A sales order must preserve its assigned payment term snapshot for downstream invoice due-date calculation
|
|
88
|
+
- Each sales order line should expose remaining quantity to ship and remaining quantity to invoice
|
|
89
|
+
- Duplicate external customer order references should be rejected or flagged according to company policy
|
|
90
|
+
- Only authorized sales users should be able to submit, confirm, place on hold, release, cancel, or close sales orders
|
|
91
|
+
|
|
92
|
+
## Reference Links
|
|
93
|
+
|
|
94
|
+
- [Odoo Sales orders documentation](https://www.odoo.com/documentation/19.0/applications/sales/sales/sales_quotations.html)
|
|
95
|
+
- [Oracle Order Management documentation](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/index.html)
|
|
96
|
+
- [SAP Sales Order processing overview](https://help.sap.com/docs/SAP_S4HANA_CLOUD)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Sales Payment Terms
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Sales Payment Terms defines how customer invoices become due once commercial billing is issued. A `SalesPaymentTerm` models rules such as net days, end-of-month due dates, installment splits, and early-payment discounts. These terms can default onto sales orders from the customer selling profile and flow forward into `SalesInvoice` so that the invoice carries the expected receivable schedule when handed off to downstream accounts receivable.
|
|
6
|
+
|
|
7
|
+
The feature is intentionally limited to customer-facing receivable terms within sales. It does not execute payment capture, collection, or settlement. Instead, it standardizes the contractual timing information that sales operations and downstream finance both need.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Standardize customer payment expectations across sales orders and invoices
|
|
12
|
+
- Reduce manual invoice-entry work by defaulting due-date schedules from negotiated payment terms
|
|
13
|
+
- Support installment or staged payment structures for milestone-based or large-value deals
|
|
14
|
+
- Enable early-payment discount handling by making discount windows explicit and reusable
|
|
15
|
+
- Provide a consistent handoff contract from sales to downstream accounts-receivable processing
|
|
16
|
+
- Separate payment timing rules from customer master data so terms can evolve independently per transaction or commercial agreement
|
|
17
|
+
- Preserve how discountable amount is interpreted by explicitly recording whether discount logic applies to gross or net invoice amount
|
|
18
|
+
|
|
19
|
+
## Process Flow
|
|
20
|
+
|
|
21
|
+
```mermaid
|
|
22
|
+
flowchart TD
|
|
23
|
+
A[Define Sales Payment Term] --> B[Configure schedule lines and discount rules]
|
|
24
|
+
B --> C[Activate term]
|
|
25
|
+
C --> D[Default term from customer selling profile or assign manually to order]
|
|
26
|
+
D --> E[Sales Invoice created from order]
|
|
27
|
+
E --> F[Copy payment term snapshot to invoice]
|
|
28
|
+
F --> G[Calculate due dates and installment amounts]
|
|
29
|
+
G --> H[Invoice becomes ready for downstream AR processing]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Scenario Patterns
|
|
33
|
+
|
|
34
|
+
- **Net 30 standard term**: A customer agreement states payment is due 30 days after the invoice date, and every invoice using that term receives a single due date 30 days later
|
|
35
|
+
- **2/10 net 30**: A customer receives a discount if the invoice is paid within 10 days; otherwise full payment is due in 30 days. The term captures both the discount window and the final due date
|
|
36
|
+
- **Milestone billing**: A project order requires 50 percent due at invoice issue and 50 percent due 30 days later, and the payment term expresses two receivable schedule lines
|
|
37
|
+
- **End-of-month settlement**: Invoices dated throughout the month become due at month end plus a fixed number of days, matching the customer's settlement policy
|
|
38
|
+
- **Default term propagation**: A customer has a default sales payment term, and each new draft sales order starts with that term before the user decides whether to override it
|
|
39
|
+
- **One-off override**: A customer usually receives net 45 terms, but a specific order is changed to net 15 because of expedited delivery and exceptional commercial approval
|
|
40
|
+
- **Term retirement**: An old payment term is deactivated when the customer contract is renegotiated, but historical orders and invoices retain the prior snapshot
|
|
41
|
+
- **Advance-payment agreement**: A deal requires an invoice with immediate due status before shipment, while the actual payment capture remains outside the sales module
|
|
42
|
+
- **Discount visibility for AR**: The issued invoice exposes the discount cutoff date so downstream receivable automation can decide whether discount handling is allowed
|
|
43
|
+
|
|
44
|
+
## Test Cases
|
|
45
|
+
|
|
46
|
+
- Creating a sales payment term with at least one schedule line should succeed
|
|
47
|
+
- The sum of installment percentages on a percentage-based payment term must equal 100 percent
|
|
48
|
+
- A payment term schedule line must not allow a negative percentage or negative fixed amount
|
|
49
|
+
- A discount date must occur on or before the final due date
|
|
50
|
+
- A payment term that offers early-payment discount must record whether the discount base is `GROSS_AMOUNT` or `NET_AMOUNT`
|
|
51
|
+
- Inactive payment terms must not be assignable to new sales orders or new invoices
|
|
52
|
+
- When a customer selling profile provides a default payment term, a new draft sales order should inherit it automatically unless the user overrides it
|
|
53
|
+
- A sales order should snapshot its assigned payment term so later edits do not alter existing downstream invoices
|
|
54
|
+
- A sales invoice due-date schedule must be computable from the invoice date and the assigned payment term
|
|
55
|
+
- End-of-month terms must produce a due date based on calendar month logic rather than a simple fixed-day offset
|
|
56
|
+
- Installment terms should generate multiple due schedule lines on the customer invoice
|
|
57
|
+
- Early-payment discount metadata must remain available after invoice issuance so downstream AR can consume it
|
|
58
|
+
- A payment term can be overridden on a draft sales order but changing it after invoice issuance should be prevented or explicitly controlled
|
|
59
|
+
- Sales payment terms must be isolated by company when receivable policies differ by legal entity
|
|
60
|
+
- Deactivating a payment term that is already referenced historically must preserve existing order and invoice snapshots
|
|
61
|
+
- Only authorized sales or finance users should be able to create, update, activate, or deactivate payment terms
|
|
62
|
+
|
|
63
|
+
## Reference Links
|
|
64
|
+
|
|
65
|
+
- [Odoo customer payment terms documentation](https://www.odoo.com/documentation/19.0/applications/finance/accounting/customer_invoices/payment_terms.html)
|
|
66
|
+
- [Oracle receivables payment terms documentation](https://docs.oracle.com/en/cloud/saas/financials/index.html)
|
|
67
|
+
- [SAP payment terms documentation](https://help.sap.com/docs/SAP_S4HANA_CLOUD)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Shipment Fulfillment
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Shipment Fulfillment records what quantity from a sales order has actually been committed to outbound delivery. A `Shipment` references one sales order and one or more sales order lines, captures ship dates, shipment quantities, delivery addresses, and external tracking context, and updates each line's shipped progress. The shipment document is the sales-side confirmation that the customer commitment moved into physical fulfillment.
|
|
6
|
+
|
|
7
|
+
This feature deliberately separates **commercial shipment control** from **warehouse stock execution**. Sales owns the shipment document, backorder logic, customer-facing shipment status, and matching rules against the order; inventory remains the owner of reservation ledgers, stock issue execution, lot or serial state, and on-hand updates. The named handoff contract from sales to inventory is `OutboundShipmentHandoff`, whose minimum payload is sales order reference, sales order line reference, shipment reference, shipped quantity, unit of measure, source fulfillment site, and ship date.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Confirm outbound fulfillment against the original customer commitment
|
|
12
|
+
- Support partial shipments and backorders without losing order-level visibility
|
|
13
|
+
- Provide the shipment basis required for shipment-gated billing policies
|
|
14
|
+
- Trigger downstream stock issue and warehouse execution processes without moving warehouse logic into sales
|
|
15
|
+
- Preserve customer-facing shipment traceability with shipment references and dates
|
|
16
|
+
- Maintain an auditable record of what was shipped, when, from where, and against which sales commitment
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Sales Order in CONFIRMED status] --> B[Create Shipment]
|
|
23
|
+
B --> C[Select open order lines]
|
|
24
|
+
C --> D[Enter shipment quantities, ship-from site, and dates]
|
|
25
|
+
D --> E{Within open quantity?}
|
|
26
|
+
E -->|No| F[Block or require controlled override]
|
|
27
|
+
E -->|Yes| G[Post Shipment]
|
|
28
|
+
G --> H[Update order line shipped quantities]
|
|
29
|
+
G --> I[Emit outbound shipment handoff to inventory]
|
|
30
|
+
H --> J{All quantities shipped?}
|
|
31
|
+
J -->|No| K[Order remains PARTIALLY SHIPPED]
|
|
32
|
+
J -->|Yes| L[Order becomes SHIPPED]
|
|
33
|
+
G --> M[Shipment eligible for invoice generation when policy requires shipment evidence]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Scenario Patterns
|
|
37
|
+
|
|
38
|
+
- **Full shipment**: Every ordered line is shipped in one outbound document and a single posted shipment completes the fulfillment side of the order
|
|
39
|
+
- **Partial shipment with backorder**: Only part of the demand ships now. The shipment posts successfully, open quantity remains on the order, and another shipment can be recorded later
|
|
40
|
+
- **Multi-line mixed fulfillment**: One line on the order ships fully while another remains open, and the shipment captures both outcomes in the same document
|
|
41
|
+
- **Channel SLA shipment**: A channel-originated order must be shipped within a short service window, and the shipment document preserves the promised ship date and actual ship date for compliance analysis
|
|
42
|
+
- **Service line exclusion**: A service line on the same sales order is invoiced without a physical shipment, while stock items still require shipment evidence
|
|
43
|
+
- **Tracking update before posting**: A fulfillment user notices the wrong carrier or tracking reference while the shipment is still draft and corrects it before posting
|
|
44
|
+
- **Ship-from-site distinction**: An order is fulfilled from a different site than originally planned, and the shipment records the actual ship-from context for auditability
|
|
45
|
+
- **Future shipment reversal**: A posted shipment is later found to be incorrect. A future reversal workflow will preserve the original posted shipment, emit a compensating correction, and keep the audit trail intact rather than mutating history
|
|
46
|
+
- **Cross-channel status update**: After shipment posts, a later sync job can push shipped status back to the originating channel without the sales module embedding channel API logic in the shipment itself
|
|
47
|
+
|
|
48
|
+
## Test Cases
|
|
49
|
+
|
|
50
|
+
- Creating a shipment against a `CONFIRMED` sales order with open shippable quantity should succeed
|
|
51
|
+
- A shipment line must reference a valid sales order line and a shipped quantity greater than zero
|
|
52
|
+
- A cancelled or closed sales order must not accept new shipments
|
|
53
|
+
- Posting a shipment must increase the referenced sales order line's cumulative shipped quantity
|
|
54
|
+
- Partial shipments must leave the remaining open quantity available for future shipment
|
|
55
|
+
- Shipping more than the remaining ordered quantity should fail or require an explicit override policy
|
|
56
|
+
- A shipment posted for a stock item should emit or call the downstream inventory handoff contract exactly once
|
|
57
|
+
- The `OutboundShipmentHandoff` payload must include sales order reference, sales order line reference, shipment reference, shipped quantity, UoM, source site, and ship date at minimum
|
|
58
|
+
- A shipment posted for a non-stock or service line must not require inventory stock execution
|
|
59
|
+
- Only posted shipments should count toward shipment-gated billing policies
|
|
60
|
+
- Shipment posting must be isolated by company and must not update sales orders belonging to another company
|
|
61
|
+
- If a shipment is reversed or corrected through a future workflow, the sales order shipped quantity must remain auditable rather than silently overwritten
|
|
62
|
+
- Sales order status should move to a partial or full shipment state based on aggregate posted shipment quantities
|
|
63
|
+
- Shipment posting should snapshot the customer shipping address used for fulfillment
|
|
64
|
+
- Only authorized fulfillment or sales users should be able to post shipments
|
|
65
|
+
- A shipment should preserve the customer, order, and line references needed for audit and customer support traceability
|
|
66
|
+
|
|
67
|
+
## Reference Links
|
|
68
|
+
|
|
69
|
+
- [Odoo delivery orders documentation](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/inventory/shipping_receiving/picking_methods.html)
|
|
70
|
+
- [Oracle Shipping Execution documentation](https://docs.oracle.com/en/cloud/saas/supply-chain-and-manufacturing/index.html)
|
|
71
|
+
- [SAP outbound delivery overview](https://help.sap.com/docs/SAP_S4HANA_CLOUD)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Channel
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Channel defines an external sell-side context such as a marketplace, storefront, or distributor feed. It scopes listing governance, channel-order synchronization, and channel-specific pricing or identifier behavior without embedding external API mechanics into every sales record.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Draft: createChannel
|
|
18
|
+
Draft --> Active: activateChannel
|
|
19
|
+
Active --> Inactive: deactivateChannel
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Command Definitions
|
|
23
|
+
|
|
24
|
+
- [createChannel](../commands/CreateChannel.md) - Create a draft channel for one company and integration type.
|
|
25
|
+
- [updateChannel](../commands/UpdateChannel.md) - Revise mutable channel metadata before or after activation under policy.
|
|
26
|
+
- [activateChannel](../commands/ActivateChannel.md) - Make the channel available for listings and sync jobs.
|
|
27
|
+
- [deactivateChannel](../commands/DeactivateChannel.md) - Stop future listing activation or new sync intake for the channel.
|
|
28
|
+
|
|
29
|
+
### Query Definitions
|
|
30
|
+
|
|
31
|
+
- [getChannel](../queries/GetChannel.md) - Retrieve one sales channel with company scope and status.
|
|
32
|
+
- [listChannels](../queries/ListChannels.md) - List channels for commerce administration and support.
|
|
33
|
+
|
|
34
|
+
### Models
|
|
35
|
+
|
|
36
|
+
- Channel
|
|
37
|
+
|
|
38
|
+
### Invariants
|
|
39
|
+
|
|
40
|
+
- Every channel belongs to exactly one company.
|
|
41
|
+
- Only ACTIVE channels may accept newly activated listings or newly started sync jobs unless a recovery policy explicitly allows otherwise.
|
|
42
|
+
- Deactivating a channel preserves historical listing and channel-order references.
|
|
43
|
+
|
|
44
|
+
### Relationships
|
|
45
|
+
|
|
46
|
+
- **References Company (cross-module)**: `companyId` isolates channel operations by legal entity.
|
|
47
|
+
- **Referenced By Listing**: Listings are defined within a specific channel context.
|
|
48
|
+
- **Referenced By ChannelOrder and SyncJob**: Channel-originated order ingestion and sync execution are both scoped to one channel.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# ChannelOrder
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
ChannelOrder stores the normalized representation of externally sourced demand before or alongside internal sales-order conversion. It preserves the originating channel identity, normalized commercial payload, raw troubleshooting context, and the operational lifecycle that distinguishes pending conversion, successful conversion, exception handling, and channel-side cancellation.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> PendingConversion: recordChannelOrder
|
|
18
|
+
PendingConversion --> Converted: convertChannelOrder
|
|
19
|
+
PendingConversion --> Exception: markChannelOrderException
|
|
20
|
+
Exception --> PendingConversion: recordChannelOrder
|
|
21
|
+
PendingConversion --> CancelledByChannel: cancelChannelOrder
|
|
22
|
+
Exception --> CancelledByChannel: cancelChannelOrder
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Command Definitions
|
|
26
|
+
|
|
27
|
+
- [recordChannelOrder](../commands/RecordChannelOrder.md) - Create or refresh the normalized channel-order record from inbound payload data.
|
|
28
|
+
- [convertChannelOrder](../commands/ConvertChannelOrder.md) - Materialize or link the internal sales order after mapping succeeds.
|
|
29
|
+
- [markChannelOrderException](../commands/MarkChannelOrderException.md) - Move the order into an actionable exception state with retry context.
|
|
30
|
+
- [cancelChannelOrder](../commands/CancelChannelOrder.md) - Record cancellation received from the originating channel before internal execution progresses too far.
|
|
31
|
+
|
|
32
|
+
### Query Definitions
|
|
33
|
+
|
|
34
|
+
- [getChannelOrder](../queries/GetChannelOrder.md) - Retrieve one normalized channel order with status, mapping, and linked sales-order details.
|
|
35
|
+
- [listChannelOrdersByStatus](../queries/ListChannelOrdersByStatus.md) - List channel orders by operational lifecycle for support and replay queues.
|
|
36
|
+
|
|
37
|
+
### Models
|
|
38
|
+
|
|
39
|
+
- ChannelOrder
|
|
40
|
+
- ChannelOrderLine
|
|
41
|
+
|
|
42
|
+
### Invariants
|
|
43
|
+
|
|
44
|
+
- Every channel order belongs to exactly one company and one originating channel.
|
|
45
|
+
- The tuple of company, channel, and external order identity is unique so duplicate deliveries remain idempotent.
|
|
46
|
+
- A channel order must enter PENDING_CONVERSION before an internal sales order is created or updated.
|
|
47
|
+
- Moving to CONVERTED requires a stored link to the internal sales order.
|
|
48
|
+
- Moving to EXCEPTION preserves actionable error context and retry metadata.
|
|
49
|
+
|
|
50
|
+
### Relationships
|
|
51
|
+
|
|
52
|
+
- **References Channel**: `channelId` identifies the origin of the external demand.
|
|
53
|
+
- **References Listing**: normalized order lines use listing mappings to resolve internal items.
|
|
54
|
+
- **References BusinessPartner (cross-module)**: customer resolution may map buyer identity to a business partner.
|
|
55
|
+
- **References SalesOrder**: `salesOrderId` is recorded once conversion succeeds.
|
|
56
|
+
- **Belongs To SyncJob**: ingestion and replay attempts are associated with a sync execution record.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# ChannelOrderLine
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
ChannelOrderLine stores the normalized line-level payload under a `ChannelOrder`. It preserves the external line identity, resolved listing or item mappings, quantity, price context, and normalized troubleshooting payload needed before conversion to internal sales-order lines.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Standard
|
|
12
|
+
|
|
13
|
+
### Command Definitions
|
|
14
|
+
|
|
15
|
+
- [recordChannelOrder](../commands/RecordChannelOrder.md) - Create or refresh normalized line payload under the parent channel order.
|
|
16
|
+
- [convertChannelOrder](../commands/ConvertChannelOrder.md) - Consume mapped channel-order lines when materializing the internal sales order.
|
|
17
|
+
|
|
18
|
+
### Query Definitions
|
|
19
|
+
|
|
20
|
+
- [getChannelOrder](../queries/GetChannelOrder.md) - Return one normalized channel order with its linked conversion context.
|
|
21
|
+
- [listChannelOrdersByStatus](../queries/ListChannelOrdersByStatus.md) - Return operational queues where line-level mapping context may need review.
|
|
22
|
+
|
|
23
|
+
### Models
|
|
24
|
+
|
|
25
|
+
- ChannelOrderLine
|
|
26
|
+
|
|
27
|
+
### Invariants
|
|
28
|
+
|
|
29
|
+
- Every channel-order line belongs to exactly one `ChannelOrder`.
|
|
30
|
+
- Quantity must remain greater than zero for a normalized commercial line.
|
|
31
|
+
- Listing, item, currency, and unit mappings are optional during ingestion but must be resolvable before successful conversion.
|
|
32
|
+
- Normalized line payload must preserve sufficient source detail for support and replay workflows.
|
|
33
|
+
|
|
34
|
+
### Relationships
|
|
35
|
+
|
|
36
|
+
- **Belongs To ChannelOrder**: `channelOrderId` ties the line to its parent inbound order.
|
|
37
|
+
- **References Listing**: `listingId` stores the resolved marketplace or storefront listing when available.
|
|
38
|
+
- **References Item (cross-module)**: `itemId` stores the resolved internal sellable item when mapping succeeds.
|
|
39
|
+
- **References primitives**: `currencyId` and `uomId` preserve the normalized commercial measurement context.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Listing
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Listing is the channel-specific sellability record for one internal item on one channel. It preserves external identifiers, publication state, optional operational metadata, and the mapping bridge required to normalize inbound channel orders back to the internal item model.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Draft: createListing
|
|
18
|
+
Draft --> Active: activateListing
|
|
19
|
+
Active --> Paused: pauseListing
|
|
20
|
+
Paused --> Active: activateListing
|
|
21
|
+
Draft --> Retired: retireListing
|
|
22
|
+
Active --> Retired: retireListing
|
|
23
|
+
Paused --> Retired: retireListing
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Command Definitions
|
|
27
|
+
|
|
28
|
+
- [createListing](../commands/CreateListing.md) - Create a draft listing for one active item on one channel.
|
|
29
|
+
- [updateListing](../commands/UpdateListing.md) - Revise identifiers, assortment metadata, or publication prerequisites.
|
|
30
|
+
- [activateListing](../commands/ActivateListing.md) - Make the listing externally sellable when all required prerequisites are present.
|
|
31
|
+
- [pauseListing](../commands/PauseListing.md) - Temporarily stop new sellability without losing identifiers or history.
|
|
32
|
+
- [retireListing](../commands/RetireListing.md) - Permanently remove the listing from active sellability while preserving references.
|
|
33
|
+
|
|
34
|
+
### Query Definitions
|
|
35
|
+
|
|
36
|
+
- [getListing](../queries/GetListing.md) - Retrieve one listing with item, channel, and identifier context.
|
|
37
|
+
- [listListingsByChannel](../queries/ListListingsByChannel.md) - List channel assortment records under one channel.
|
|
38
|
+
- [getListingByExternalIdentifier](../queries/GetListingByExternalIdentifier.md) - Resolve the internal listing from a channel-provided external identifier.
|
|
39
|
+
|
|
40
|
+
### Models
|
|
41
|
+
|
|
42
|
+
- Listing
|
|
43
|
+
|
|
44
|
+
### Invariants
|
|
45
|
+
|
|
46
|
+
- Every listing belongs to exactly one company, one channel, and one sellable item.
|
|
47
|
+
- A listing cannot be ACTIVE unless the referenced item and channel are both ACTIVE and all required external identifiers are present.
|
|
48
|
+
- Historical channel orders remain able to reference a retired listing for audit and support traceability.
|
|
49
|
+
- External identifiers must be unique within the channel context according to operational policy.
|
|
50
|
+
|
|
51
|
+
### Relationships
|
|
52
|
+
|
|
53
|
+
- **References Channel**: `channelId` defines the external commercial context.
|
|
54
|
+
- **References Item (cross-module)**: `itemId` links the listing to the internal sellable SKU.
|
|
55
|
+
- **Optionally References SalesPriceRule**: Activation may require a price-linkage or pricing-eligibility check.
|
|
56
|
+
- **Referenced By ChannelOrder**: Inbound channel orders use the listing mapping to normalize external identifiers.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# SalesCreditNote
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
SalesCreditNote is the commercial correction document issued after an invoice already exists. It reduces billed quantity or amount for allowances, disputes, or price corrections while preserving the original invoice as immutable evidence.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Draft: createSalesCreditNote
|
|
18
|
+
Draft --> Issued: issueSalesCreditNote
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Command Definitions
|
|
22
|
+
|
|
23
|
+
- [createSalesCreditNote](../commands/CreateSalesCreditNote.md) - Create a draft credit note referencing an issued invoice and one or more affected invoice lines.
|
|
24
|
+
- [updateSalesCreditNote](../commands/UpdateSalesCreditNote.md) - Correct draft credit-note amounts, reasons, or references before issue.
|
|
25
|
+
- [issueSalesCreditNote](../commands/IssueSalesCreditNote.md) - Validate the commercial correction and issue the immutable credit note.
|
|
26
|
+
|
|
27
|
+
### Query Definitions
|
|
28
|
+
|
|
29
|
+
- [getSalesCreditNote](../queries/GetSalesCreditNote.md) - Retrieve one credit note with correction metadata and affected lines.
|
|
30
|
+
- [listSalesCreditNotesByInvoice](../queries/ListSalesCreditNotesByInvoice.md) - List all credit corrections issued against one invoice.
|
|
31
|
+
|
|
32
|
+
### Models
|
|
33
|
+
|
|
34
|
+
- SalesCreditNote
|
|
35
|
+
- SalesCreditNoteLine
|
|
36
|
+
|
|
37
|
+
### Invariants
|
|
38
|
+
|
|
39
|
+
- Every credit note belongs to exactly one company and references one issued sales invoice.
|
|
40
|
+
- A credit note must preserve correction reason, tax basis, customer identity, and linked invoice identity at issue time.
|
|
41
|
+
- The cumulative credited quantity or amount against any invoice line cannot exceed the original issued quantity or amount without a documented override policy.
|
|
42
|
+
|
|
43
|
+
### Relationships
|
|
44
|
+
|
|
45
|
+
- **Owns SalesCreditNoteLine**: Line-level corrections specify the quantities or amounts being reduced.
|
|
46
|
+
- **References SalesInvoice**: `salesInvoiceId` identifies the invoice being corrected.
|
|
47
|
+
- **References SalesOrder**: Credit notes preserve the originating commercial context through the linked invoice lines.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# SalesCreditNoteLine
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
SalesCreditNoteLine stores the specific invoice-line quantity or amount being corrected on a credit note. It preserves correction reason, tax basis, and original billing reference so downstream posting remains deterministic.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Standard
|
|
12
|
+
|
|
13
|
+
### Command Definitions
|
|
14
|
+
|
|
15
|
+
- [createSalesCreditNote](../commands/CreateSalesCreditNote.md) - Create initial credit-note lines against issued invoice lines.
|
|
16
|
+
- [updateSalesCreditNote](../commands/UpdateSalesCreditNote.md) - Revise draft correction quantities or amounts before issue.
|
|
17
|
+
- [issueSalesCreditNote](../commands/IssueSalesCreditNote.md) - Freeze the final correction baseline at issue time.
|
|
18
|
+
|
|
19
|
+
### Query Definitions
|
|
20
|
+
|
|
21
|
+
- [getSalesCreditNote](../queries/GetSalesCreditNote.md) - Return line-level correction details for one credit note.
|
|
22
|
+
- [listSalesCreditNotesByInvoice](../queries/ListSalesCreditNotesByInvoice.md) - Expose the correction history attached to one invoice.
|
|
23
|
+
|
|
24
|
+
### Models
|
|
25
|
+
|
|
26
|
+
- SalesCreditNoteLine
|
|
27
|
+
|
|
28
|
+
### Invariants
|
|
29
|
+
|
|
30
|
+
- Every credit-note line belongs to exactly one credit note and references one issued invoice line.
|
|
31
|
+
- Credited quantity or amount must be greater than zero.
|
|
32
|
+
- The line preserves the original invoice-line identity and correction reason so later downstream posting does not depend on mutable upstream data.
|
|
33
|
+
|
|
34
|
+
### Relationships
|
|
35
|
+
|
|
36
|
+
- **Belongs To SalesCreditNote**: `salesCreditNoteId` ties the line to its parent correction document.
|
|
37
|
+
- **References SalesInvoiceLine**: `salesInvoiceLineId` identifies the billed evidence being corrected.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# SalesInvoice
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
SalesInvoice is the customer-facing receivable document issued from the sales domain. It snapshots invoice identity, billing policy outcome, price and tax context, payment-term output, and customer references so downstream accounts receivable can consume a stable commercial document.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Stateful
|
|
12
|
+
|
|
13
|
+
#### State Transitions
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
stateDiagram-v2
|
|
17
|
+
[*] --> Draft: createSalesInvoice
|
|
18
|
+
Draft --> Issued: issueSalesInvoice
|
|
19
|
+
Issued --> Sent: sendSalesInvoice
|
|
20
|
+
Draft --> Cancelled: cancelSalesInvoice
|
|
21
|
+
Issued --> Cancelled: cancelSalesInvoice
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Command Definitions
|
|
25
|
+
|
|
26
|
+
- [createSalesInvoice](../commands/CreateSalesInvoice.md) - Create a draft invoice with references to the customer, order, and invoice lines.
|
|
27
|
+
- [updateSalesInvoice](../commands/UpdateSalesInvoice.md) - Correct mutable invoice fields while the document remains draft.
|
|
28
|
+
- [issueSalesInvoice](../commands/IssueSalesInvoice.md) - Validate billing policy, snapshot receivable metadata, and issue the invoice.
|
|
29
|
+
- [sendSalesInvoice](../commands/SendSalesInvoice.md) - Record customer-facing delivery metadata after issuance.
|
|
30
|
+
- [cancelSalesInvoice](../commands/CancelSalesInvoice.md) - Cancel a draft or issued invoice before downstream AR handoff acceptance.
|
|
31
|
+
|
|
32
|
+
### Query Definitions
|
|
33
|
+
|
|
34
|
+
- [getSalesInvoice](../queries/GetSalesInvoice.md) - Retrieve one invoice with lines, due schedule, and status metadata.
|
|
35
|
+
- [listSalesInvoicesBySalesOrder](../queries/ListSalesInvoicesBySalesOrder.md) - List all invoices issued against one sales order.
|
|
36
|
+
|
|
37
|
+
### Models
|
|
38
|
+
|
|
39
|
+
- SalesInvoice
|
|
40
|
+
- SalesInvoiceLine
|
|
41
|
+
|
|
42
|
+
### Invariants
|
|
43
|
+
|
|
44
|
+
- Every invoice belongs to exactly one company and one customer.
|
|
45
|
+
- An issued invoice preserves external invoice number, invoice date, payment-term snapshot, customer tax identity, taxable amount, and tax amount.
|
|
46
|
+
- Invoice quantities and prices must validate against the originating sales order and, when required, posted shipment evidence.
|
|
47
|
+
- A cancelled invoice preserves historical references and may not delete or silently rewrite issued billing evidence.
|
|
48
|
+
|
|
49
|
+
### Relationships
|
|
50
|
+
|
|
51
|
+
- **Owns SalesInvoiceLine**: Invoice lines hold the detailed billed quantities and prices.
|
|
52
|
+
- **References SalesOrder**: `salesOrderId` links the invoice to the commercial commitment being billed.
|
|
53
|
+
- **References Shipment**: Shipment-gated billing may cite posted shipment evidence.
|
|
54
|
+
- **References SalesPaymentTerm**: The invoice snapshots the assigned term and derived due schedule.
|
|
55
|
+
- **Referenced By SalesCreditNote**: Credit notes correct previously issued invoice evidence without mutating the original invoice.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# SalesInvoiceLine
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
SalesInvoiceLine stores the specific billed quantity, price, tax basis, and order reference included on one invoice line. It is the unit against which cumulative invoicing and later credit-note corrections are validated.
|
|
6
|
+
|
|
7
|
+
## Domain Model Definitions
|
|
8
|
+
|
|
9
|
+
### Model type
|
|
10
|
+
|
|
11
|
+
Standard
|
|
12
|
+
|
|
13
|
+
### Command Definitions
|
|
14
|
+
|
|
15
|
+
- [createSalesInvoice](../commands/CreateSalesInvoice.md) - Create draft invoice lines from selected sales-order lines.
|
|
16
|
+
- [updateSalesInvoice](../commands/UpdateSalesInvoice.md) - Correct draft invoice quantities or references before issue.
|
|
17
|
+
- [issueSalesInvoice](../commands/IssueSalesInvoice.md) - Freeze billed quantity, price, and tax basis at issue time.
|
|
18
|
+
|
|
19
|
+
### Query Definitions
|
|
20
|
+
|
|
21
|
+
- [getSalesInvoice](../queries/GetSalesInvoice.md) - Return line-level billed quantities and references for one invoice.
|
|
22
|
+
- [listSalesInvoicesBySalesOrder](../queries/ListSalesInvoicesBySalesOrder.md) - Summarize billed line history for a selected order.
|
|
23
|
+
|
|
24
|
+
### Models
|
|
25
|
+
|
|
26
|
+
- SalesInvoiceLine
|
|
27
|
+
|
|
28
|
+
### Invariants
|
|
29
|
+
|
|
30
|
+
- Every invoice line belongs to exactly one sales invoice and references exactly one sales-order line.
|
|
31
|
+
- Invoice quantity must be greater than zero and cannot exceed the allowed order-based or shipment-based billing quantity without an explicit override policy.
|
|
32
|
+
- Issued invoice lines preserve the order price snapshot rather than re-resolving live price rules.
|
|
33
|
+
|
|
34
|
+
### Relationships
|
|
35
|
+
|
|
36
|
+
- **Belongs To SalesInvoice**: `salesInvoiceId` ties the line to its parent invoice.
|
|
37
|
+
- **References SalesOrderLine**: `salesOrderLineId` validates billed quantity and price against the originating order line.
|
|
38
|
+
- **Optionally References ShipmentLine**: Shipment-gated billing may store shipment evidence at line level.
|
|
39
|
+
- **Referenced By SalesCreditNoteLine**: Credit notes point back to issued invoice lines they correct.
|