@tailor-platform/erp-kit 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +12 -12
- package/dist/cli.mjs +503 -32
- 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 +15 -4
- 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-module.test.ts +17 -3
- package/src/commands/init-module.ts +0 -12
- package/src/commands/init.ts +4 -0
- package/src/commands/lib/distribute.test.ts +32 -1
- package/src/commands/lib/distribute.ts +47 -5
- package/src/commands/lib/sync-check-source.test.ts +1 -1
- package/src/commands/update.test.ts +16 -0
- package/src/commands/update.ts +4 -1
- package/src/generator/generate-code-boilerplate.test.ts +9 -1
- package/src/generator/generate-seed.ts +69 -0
- package/src/generator/scaffold.ts +6 -2
- package/src/mdschema.ts +39 -3
- 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/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/__dot__gitignore +3 -0
- package/templates/scaffold/module/eslint.config.js +31 -0
- package/templates/scaffold/module/generated/kysely-tailordb.ts +3 -0
- package/templates/scaffold/module/lib/types.ts +1 -6
- package/templates/scaffold/module/package.json +26 -0
- package/templates/scaffold/module/seed/index.ts +19 -0
- package/templates/scaffold/module/tsconfig.json +16 -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
- /package/{templates/scaffold/module/generated → src/modules/inventory/db}/.gitkeep +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# UpdatePurchasePriceRule
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
UpdatePurchasePriceRule changes the live pricing condition on an existing supplier price rule without modifying any purchase orders that already snapshotted that rule's price.
|
|
6
|
+
|
|
7
|
+
## Business Rules
|
|
8
|
+
|
|
9
|
+
- Target rule must exist
|
|
10
|
+
- Updated references and value fields must satisfy the same validation rules as create
|
|
11
|
+
- Updating an inactive rule is allowed so it can be corrected before reactivation
|
|
12
|
+
- Updated precedence must remain unique within the supplier pricing context
|
|
13
|
+
- Historical purchase orders preserve the original ordered price even when the source rule changes
|
|
14
|
+
|
|
15
|
+
## Process Flow
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart TD
|
|
19
|
+
A[Receive update request] --> B{Rule exists?}
|
|
20
|
+
B -->|No| C[Return PRICE_RULE_NOT_FOUND]
|
|
21
|
+
B -->|Yes| D{References and values valid?}
|
|
22
|
+
D -->|No| E[Return validation error]
|
|
23
|
+
D -->|Yes| F{Unique precedence?}
|
|
24
|
+
F -->|No| G[Return DUPLICATE_RULE_PRECEDENCE]
|
|
25
|
+
F -->|Yes| H[Update rule]
|
|
26
|
+
H --> I[Return updated rule]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## External Dependencies
|
|
30
|
+
|
|
31
|
+
- [item-management::GetItem](../../../item-management/docs/queries/GetItem.md) - Validate item existence and active status
|
|
32
|
+
- [primitives::GetCurrency](../../../primitives/docs/queries/GetCurrency.md) - Validate transaction currency
|
|
33
|
+
- [primitives::GetUnit](../../../primitives/docs/queries/GetUnit.md) - Validate purchase unit of measure
|
|
34
|
+
|
|
35
|
+
## Error Scenarios
|
|
36
|
+
|
|
37
|
+
- **PRICE_RULE_NOT_FOUND**: Target price rule does not exist
|
|
38
|
+
- **ITEM_NOT_FOUND**: Referenced item does not exist
|
|
39
|
+
- **ITEM_NOT_ACTIVE**: Referenced item is inactive
|
|
40
|
+
- **CURRENCY_NOT_FOUND**: Referenced currency does not exist
|
|
41
|
+
- **UNIT_NOT_FOUND**: Referenced purchase unit does not exist
|
|
42
|
+
- **INVALID_UNIT_PRICE**: Unit price is zero or negative
|
|
43
|
+
- **INVALID_MINIMUM_QUANTITY**: Minimum quantity is negative
|
|
44
|
+
- **INVALID_EFFECTIVE_RANGE**: Effective end date is earlier than effective start date
|
|
45
|
+
- **DUPLICATE_RULE_PRECEDENCE**: Another rule already owns the same precedence context
|
|
46
|
+
|
|
47
|
+
## Test Cases
|
|
48
|
+
|
|
49
|
+
- updates price and quantity break on an active rule
|
|
50
|
+
- updates an inactive rule without reactivating it
|
|
51
|
+
- preserves historical purchase-order snapshots after update
|
|
52
|
+
- returns error when rule does not exist
|
|
53
|
+
- returns error when updated references are invalid
|
|
54
|
+
- returns error when the updated item does not exist
|
|
55
|
+
- returns error when the updated item is inactive
|
|
56
|
+
- returns error when the updated unit does not exist
|
|
57
|
+
- returns error when the updated unit price is not positive
|
|
58
|
+
- returns error when the updated minimum quantity is negative
|
|
59
|
+
- returns error when the updated effective range is inverted
|
|
60
|
+
- returns error when updated precedence duplicates another rule
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Goods Receipt Matching
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Goods Receipt Matching records what quantity from a purchase order has actually been received from the supplier. A `GoodsReceipt` references one purchase order and one or more purchase order lines, captures received quantities and receipt dates, and updates each line's received progress. The receipt document is the procurement-side confirmation that supplier fulfillment occurred.
|
|
6
|
+
|
|
7
|
+
This feature deliberately separates **commercial receipt confirmation** from **warehouse stock execution**. Purchase owns the receipt document and the matching rules against the purchase order; inventory remains the owner of the resulting stock movement, putaway, lot or serial recording, and on-hand updates. That split makes receipts usable both for stock items and for service or non-stock procurement scenarios. The named handoff contract from purchase to inventory is `InboundReceiptHandoff`, whose minimum payload is purchase order reference, purchase order line reference, goods receipt reference, received quantity, unit of measure, and receipt date.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Confirm supplier fulfillment against the original purchase commitment
|
|
12
|
+
- Support partial deliveries and backorders without losing order-level visibility
|
|
13
|
+
- Enforce over-receipt and under-receipt tolerance rules on purchase order lines
|
|
14
|
+
- Provide the receipt basis required for 3-way supplier bill matching
|
|
15
|
+
- Trigger downstream inbound stock or service-acceptance processes without moving warehouse logic into purchase
|
|
16
|
+
- Preserve an auditable history of what was received, when, and against which supplier commitment
|
|
17
|
+
|
|
18
|
+
## Process Flow
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
flowchart TD
|
|
22
|
+
A[Purchase Order in ORDERED status] --> B[Create Goods Receipt]
|
|
23
|
+
B --> C[Select open order lines]
|
|
24
|
+
C --> D[Enter received quantities and dates]
|
|
25
|
+
D --> E{Within tolerance?}
|
|
26
|
+
E -->|No| F[Block or require override]
|
|
27
|
+
E -->|Yes| G[Post Goods Receipt]
|
|
28
|
+
G --> H[Update PO line received quantities]
|
|
29
|
+
G --> I[Emit inbound receipt handoff to inventory]
|
|
30
|
+
H --> J{All quantities received?}
|
|
31
|
+
J -->|No| K[PO remains PARTIALLY RECEIVED]
|
|
32
|
+
J -->|Yes| L[PO becomes RECEIVED]
|
|
33
|
+
G --> M[Receipt eligible for supplier bill matching]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Scenario Patterns
|
|
37
|
+
|
|
38
|
+
- **Full delivery**: The supplier delivers every ordered line in one shipment and a single posted goods receipt completes the receiving side of the order
|
|
39
|
+
- **Partial shipment with backorder**: Only half the quantity arrives. The receipt posts successfully, open quantity remains on the PO, and another receipt can be recorded later
|
|
40
|
+
- **Overdelivery within tolerance**: A supplier sends 102 units against an order for 100 where a 2 percent over-receipt tolerance is allowed, so the receipt is accepted
|
|
41
|
+
- **Overdelivery beyond tolerance**: A supplier sends materially more than ordered, and the receipt is blocked or requires an explicit procurement exception
|
|
42
|
+
- **Split line receiving**: One line on the order is fully received while another remains open, and the receipt captures both outcomes in the same document
|
|
43
|
+
- **Service acceptance**: A non-stock service line is marked received or accepted without creating warehouse-level stock, but the receipt still unlocks downstream bill matching
|
|
44
|
+
- **Receipt date tracking**: The supplier shipment arrives late, and the posted receipt captures the actual date for lead-time and supplier-performance analysis
|
|
45
|
+
- **Receipt correction before posting**: A receiver notices a quantity entry mistake while the receipt is still draft and corrects it before it updates PO fulfillment
|
|
46
|
+
- **Future receipt reversal**: A posted receipt is later found to be incorrect. A future reversal workflow will preserve the original posted receipt, emit a compensating correction, and keep the audit trail intact rather than mutating history
|
|
47
|
+
|
|
48
|
+
## Test Cases
|
|
49
|
+
|
|
50
|
+
- Creating a goods receipt against an `ORDERED` purchase order with open quantity should succeed
|
|
51
|
+
- A goods receipt line must reference a valid purchase order line and a received quantity greater than zero
|
|
52
|
+
- A cancelled or closed purchase order must not accept new goods receipts
|
|
53
|
+
- Posting a goods receipt must increase the referenced purchase order line's cumulative received quantity
|
|
54
|
+
- Partial receipts must leave the remaining open quantity available for future receipts
|
|
55
|
+
- Receiving more than the ordered quantity plus configured tolerance should fail or require an explicit override
|
|
56
|
+
- Receiving against an inactive item or inactive supplier should be prevented if the order is no longer valid for execution
|
|
57
|
+
- A goods receipt posted for a stock item should emit or call the downstream inventory handoff contract exactly once
|
|
58
|
+
- The `InboundReceiptHandoff` payload must include purchase order reference, purchase order line reference, goods receipt reference, received quantity, UoM, and receipt date at minimum
|
|
59
|
+
- A goods receipt posted for a non-stock or service line must not require warehouse stock execution
|
|
60
|
+
- Only posted goods receipts should count toward 3-way supplier bill matching
|
|
61
|
+
- Receipt posting must be isolated by company and must not update purchase orders belonging to another company
|
|
62
|
+
- If a receipt is reversed or corrected through a future workflow, the purchase order received quantity must remain auditable rather than silently overwritten
|
|
63
|
+
- Purchase order status should move to a partial or full receipt state based on aggregate posted receipt quantities
|
|
64
|
+
- Only authorized receiving or procurement users should be able to post goods receipts
|
|
65
|
+
- A goods receipt should preserve the supplier, order, and line references needed for audit and traceability
|
|
66
|
+
|
|
67
|
+
## Reference Links
|
|
68
|
+
|
|
69
|
+
- [Odoo vendor bills and three-way matching](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/purchase/manage_deals/manage.html#vendor-bills)
|
|
70
|
+
- [Oracle Fusion Cloud Procurement documentation](https://docs.oracle.com/en/cloud/saas/procurement/index.html)
|
|
71
|
+
- [SAP receipt confirmation documentation](https://help.sap.com/docs/SAP_S4HANA_CLOUD/65de2977205c403bbc107264b8eccf4b/552eb9c732c14df6a2926efce6d890ad.html)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Purchase Order Lifecycle
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Purchase Order Lifecycle governs how a supplier commitment is created, reviewed, placed, fulfilled, and closed. A `PurchaseOrder` records the commercial agreement with a supplier for one or more items, including ordered quantity, expected delivery, unit price, currency, payment-term reference, and receiving site. The order is the primary document that downstream receipts and supplier bills match against.
|
|
6
|
+
|
|
7
|
+
The lifecycle tracks both document control and fulfillment progress. A purchase order begins in draft, may be submitted for approval, can be explicitly rejected back to draft with a reason, becomes ordered when released to the supplier, then moves through partial or full receipt and partial or full billing states as execution proceeds. This gives procurement teams a single source of truth for what is still open with each supplier.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Create a formal, auditable supplier commitment before goods or services are received
|
|
12
|
+
- Freeze negotiated commercial terms at the time an order is placed, even if future price lists change
|
|
13
|
+
- Capture the company and receiving-site context needed for receipt routing and supplier traceability
|
|
14
|
+
- Track open quantity, received quantity, billed quantity, and remaining commitment per line
|
|
15
|
+
- Provide the reference document required for receipt matching and supplier bill matching
|
|
16
|
+
- Support partial fulfillment without losing visibility into remaining supplier obligations
|
|
17
|
+
- Prevent inactive suppliers, inactive items, or incomplete orders from entering downstream execution
|
|
18
|
+
|
|
19
|
+
## Process Flow
|
|
20
|
+
|
|
21
|
+
```mermaid
|
|
22
|
+
flowchart TD
|
|
23
|
+
A[Create Purchase Order] --> B[DRAFT]
|
|
24
|
+
B --> C[Add supplier, lines, prices, terms]
|
|
25
|
+
C --> D{Submit?}
|
|
26
|
+
D -->|No| C
|
|
27
|
+
D -->|Yes| E[SUBMITTED]
|
|
28
|
+
E --> F{Approve?}
|
|
29
|
+
F -->|Reject| R[REJECTED]
|
|
30
|
+
R --> B
|
|
31
|
+
F -->|Approve and send| G[ORDERED]
|
|
32
|
+
G --> H{Receipt posted?}
|
|
33
|
+
H -->|Partial| I[PARTIALLY RECEIVED]
|
|
34
|
+
H -->|Full| J[RECEIVED]
|
|
35
|
+
I --> K{Supplier bill matched?}
|
|
36
|
+
J --> K
|
|
37
|
+
K -->|Partial| L[PARTIALLY BILLED]
|
|
38
|
+
K -->|Full| M[BILLED]
|
|
39
|
+
I --> N{Close remaining?}
|
|
40
|
+
J --> N
|
|
41
|
+
L --> N
|
|
42
|
+
M --> N
|
|
43
|
+
N -->|Close| O[CLOSED]
|
|
44
|
+
B --> P[CANCELLED]
|
|
45
|
+
E --> P
|
|
46
|
+
G --> P
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Scenario Patterns
|
|
50
|
+
|
|
51
|
+
- **Standard stock purchase**: A buyer creates an order for replenishment items, applies supplier pricing and payment terms, submits it, and sends it to the supplier once approved
|
|
52
|
+
- **Rejected for revision**: An approver rejects a submitted order because the receiving site or supplier quote is wrong, and the order returns to draft with the rejection reason preserved for audit
|
|
53
|
+
- **Split delivery**: A supplier confirms the order but ships in two batches. The purchase order remains open after the first receipt and closes only when all ordered quantity is received or explicitly closed out
|
|
54
|
+
- **Price override before release**: A buyer starts from an automatically suggested supplier price rule but overrides one line before approval due to a one-time negotiated exception
|
|
55
|
+
- **Service or non-stock procurement**: A purchase order is created for a supplier-provided service or consumable item that may still require bill matching even if no warehouse stock is updated
|
|
56
|
+
- **Order cancellation before fulfillment**: An order is cancelled after submission because demand disappears and no receipt or bill has yet been matched
|
|
57
|
+
- **Close remaining balance**: A supplier underdelivers the final 2 units and the buyer chooses to close the remaining open quantity instead of keeping the order indefinitely open
|
|
58
|
+
- **Multi-line mixed fulfillment**: Some lines on the same order are fully received while others remain open, and line-level progress rolls up to the document status
|
|
59
|
+
- **Supplier change control**: A buyer duplicates and revises a draft order rather than changing the supplier on an already ordered document, preserving traceability
|
|
60
|
+
|
|
61
|
+
## Test Cases
|
|
62
|
+
|
|
63
|
+
- Creating a purchase order with a valid ACTIVE supplier, company, and at least one line should succeed
|
|
64
|
+
- A purchase order line must require an ACTIVE item, quantity greater than zero, and a non-negative unit price
|
|
65
|
+
- Purchase orders can only be created in `DRAFT` status
|
|
66
|
+
- A `DRAFT` order can be revised freely, but `ORDERED` commercial fields must not change without an explicit revision workflow
|
|
67
|
+
- Submitting a purchase order without any lines should fail
|
|
68
|
+
- Submitting a purchase order without a receiving site when the line requires physical receipt should fail
|
|
69
|
+
- Submitting a purchase order for a partner that does not carry the SUPPLIER role should fail
|
|
70
|
+
- Approving or ordering a purchase order whose supplier is INACTIVE should fail
|
|
71
|
+
- Rejecting a submitted purchase order should record the rejection reason and return the document to `DRAFT`
|
|
72
|
+
- Cancelling a purchase order after a posted receipt or matched supplier bill exists should be prevented
|
|
73
|
+
- Posting a partial receipt should update line received quantities and move the order to a partial receipt status
|
|
74
|
+
- Matching a supplier bill should update line billed quantities independently of receipt quantities
|
|
75
|
+
- Closing a purchase order should be allowed only when all remaining open quantities are fulfilled, cancelled, or explicitly written off
|
|
76
|
+
- Purchase order totals and open balances must be isolated per company
|
|
77
|
+
- The applied unit price on a purchase order line must remain unchanged even if the underlying supplier price rule is later edited
|
|
78
|
+
- A purchase order must preserve its assigned payment term snapshot for downstream bill due-date calculation
|
|
79
|
+
- Each purchase order line should expose remaining quantity to receive and remaining quantity to bill
|
|
80
|
+
- Duplicate external supplier order references should be rejected or flagged according to company policy
|
|
81
|
+
- Only authorized procurement users should be able to submit, approve, cancel, or close purchase orders
|
|
82
|
+
|
|
83
|
+
## Reference Links
|
|
84
|
+
|
|
85
|
+
- [Odoo Purchase documentation](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/purchase.html)
|
|
86
|
+
- [Oracle Fusion Cloud Procurement guide](https://docs.oracle.com/en/cloud/saas/procurement/index.html)
|
|
87
|
+
- [SAP procurement overview](https://help.sap.com/docs/SAP_S4HANA_CLOUD)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Purchase Payment Terms
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Purchase Payment Terms defines how supplier invoices become due once commercial purchasing is complete. A `PurchasePaymentTerm` models rules such as net days, end-of-month due dates, installment splits, and early-payment discounts. These terms can default onto purchase orders from the supplier's purchasing profile and flow forward into `PurchaseBill` so that the bill carries the expected supplier settlement schedule when handed off to accounts payable.
|
|
6
|
+
|
|
7
|
+
The feature is intentionally limited to supplier-facing payable terms within procurement. It does not execute payment runs or post accounting entries. Instead, it standardizes the contractual timing information that purchasing and accounts payable both need.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Standardize supplier settlement expectations across purchase orders and supplier bills
|
|
12
|
+
- Reduce manual bill-entry work by defaulting due-date schedules from negotiated payment terms
|
|
13
|
+
- Support installment or staged payment structures for large or milestone-based purchases
|
|
14
|
+
- Enable early-payment discount handling by making discount windows explicit and reusable
|
|
15
|
+
- Provide a consistent handoff contract from procurement to downstream accounts-payable processing
|
|
16
|
+
- Separate payment timing rules from supplier master data so terms can evolve independently per transaction or 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 Purchase Payment Term] --> B[Configure schedule lines and discount rules]
|
|
24
|
+
B --> C[Activate term]
|
|
25
|
+
C --> D[Default term from supplier purchasing profile or assign manually to PO]
|
|
26
|
+
D --> E[Supplier Bill created from order or entered manually]
|
|
27
|
+
E --> F[Copy payment term snapshot to bill]
|
|
28
|
+
F --> G[Calculate due dates and installment amounts]
|
|
29
|
+
G --> H[Bill becomes ready for downstream AP processing]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Scenario Patterns
|
|
33
|
+
|
|
34
|
+
- **Net 30 standard term**: A supplier agreement states payment is due 30 days after the invoice date, and every bill using that term receives a single due date 30 days later
|
|
35
|
+
- **2/10 net 30**: A supplier grants a discount if the bill is paid within 10 days, otherwise full payment is due in 30 days. The term captures both the discount window and final due date
|
|
36
|
+
- **Supplier default term propagation**: A supplier is configured with a default purchase payment term, and each new draft PO starts with that term before the buyer decides whether to override it
|
|
37
|
+
- **Installment schedule**: A capital purchase requires 30 percent upfront and 70 percent after delivery. The payment term expresses two due schedule lines rather than a single maturity date
|
|
38
|
+
- **End-of-month settlement**: Bills dated throughout the month become due at month end plus a fixed number of days, matching supplier accounting policy
|
|
39
|
+
- **Term override for one PO**: A buyer uses the supplier's usual net 45 term on most orders but overrides a specific order to net 15 because of a negotiated expedited arrangement
|
|
40
|
+
- **Term retirement**: An old payment term is deactivated when the supplier contract is renegotiated, but historical orders and bills retain the prior snapshot
|
|
41
|
+
- **Manual supplier bill entry**: A bill is entered directly against a PO and inherits its purchase payment term even if no automatic bill generation exists
|
|
42
|
+
- **Discount visibility for AP**: The matched supplier bill exposes the discount cutoff date so downstream AP automation can decide whether to pay early
|
|
43
|
+
|
|
44
|
+
## Test Cases
|
|
45
|
+
|
|
46
|
+
- Creating a purchase 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 purchase orders or new supplier bills
|
|
52
|
+
- When a supplier purchasing profile provides a default payment term, a new draft purchase order should inherit it automatically unless the buyer overrides it
|
|
53
|
+
- A purchase order should snapshot its assigned payment term so later edits do not alter existing downstream bills
|
|
54
|
+
- A supplier bill due-date schedule must be computable from the bill 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 supplier bill
|
|
57
|
+
- Early-payment discount metadata must remain available after bill matching so downstream AP can consume it
|
|
58
|
+
- A payment term can be overridden on a draft purchase order but changing it after matched billing should be prevented or explicitly controlled
|
|
59
|
+
- Purchase payment terms must be isolated by company when procurement policies differ by legal entity
|
|
60
|
+
- Deactivating a payment term that is already referenced historically must preserve existing order and bill snapshots
|
|
61
|
+
- Only authorized procurement or finance users should be able to create, update, activate, or deactivate payment terms
|
|
62
|
+
|
|
63
|
+
## Reference Links
|
|
64
|
+
|
|
65
|
+
- [Odoo payment terms documentation](https://www.odoo.com/documentation/19.0/applications/finance/accounting/customer_invoices/payment_terms.html)
|
|
66
|
+
- [Oracle Fusion Cloud Financials and procurement documentation](https://docs.oracle.com/en/cloud/saas/index.html)
|
|
67
|
+
- [SAP S/4HANA Cloud documentation](https://help.sap.com/docs/SAP_S4HANA_CLOUD)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Supplier Bill Matching
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Supplier Bill Matching captures supplier invoices as `PurchaseBill` documents and validates them against the commercial and fulfillment evidence already recorded in purchase. Each bill line references one or more purchase order lines and, when 3-way matching is required, the posted goods receipts that prove quantity has actually been received. The result is a procurement-side decision: is this supplier invoice commercially acceptable, blocked for variance, cancelled before downstream acceptance, or ready for downstream accounts payable?
|
|
6
|
+
|
|
7
|
+
This feature does not post journal entries or execute payment. Its responsibility is to compare what the supplier invoiced with what was ordered and received, detect mismatches, preserve tax and invoice identity required for legal validity, and preserve a clean handoff contract for future AP and accounting modules. The minimum bill lifecycle is `DRAFT` → `BLOCKED` or `MATCHED`, with `CANCELLED` available only before downstream AP handoff acceptance.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Prevent overbilling by ensuring supplier invoices align with ordered and received quantities
|
|
12
|
+
- Detect price variances between purchase order commitments and supplier invoice lines
|
|
13
|
+
- Support both 2-way matching (order to invoice) and 3-way matching (order, receipt, invoice)
|
|
14
|
+
- Provide a clear blocked-versus-ready status before bills reach downstream accounts-payable workflows
|
|
15
|
+
- Allow matched or blocked bills to be cancelled while they are still owned by purchase and have not yet been accepted by downstream AP
|
|
16
|
+
- Carry supplier invoice identity, payment-term snapshot, and due-date schedule into payable processing
|
|
17
|
+
- Capture supplier tax identifiers, tax codes, and tax amounts needed by downstream AP validation
|
|
18
|
+
- Preserve an auditable link between invoice lines, purchase orders, and receipts
|
|
19
|
+
|
|
20
|
+
## Process Flow
|
|
21
|
+
|
|
22
|
+
```mermaid
|
|
23
|
+
flowchart TD
|
|
24
|
+
A[Create Purchase Bill] --> B[Enter supplier invoice reference and lines]
|
|
25
|
+
B --> C[Match bill lines to PO lines]
|
|
26
|
+
C --> D{Matching mode?}
|
|
27
|
+
D -->|2-way| E[Compare invoice to ordered qty and price]
|
|
28
|
+
D -->|3-way| F[Compare invoice to ordered qty, price, and posted receipts]
|
|
29
|
+
E --> G{Within tolerance?}
|
|
30
|
+
F --> G
|
|
31
|
+
G -->|No| H[BLOCKED FOR VARIANCE]
|
|
32
|
+
G -->|Yes| I[MATCHED]
|
|
33
|
+
I --> J[Calculate due schedule from payment term]
|
|
34
|
+
J --> K[Ready for downstream AP or accounting handoff]
|
|
35
|
+
H --> L{Cancel before AP handoff?}
|
|
36
|
+
I --> L
|
|
37
|
+
L -->|Yes| M[CANCELLED]
|
|
38
|
+
L -->|No| J
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Scenario Patterns
|
|
42
|
+
|
|
43
|
+
- **Perfect 3-way match**: The supplier invoice arrives after the goods receipt, and billed quantities and prices match the purchase order exactly, so the bill is marked ready
|
|
44
|
+
- **Price variance within tolerance**: The supplier invoice price differs slightly from the ordered price due to exchange rounding or minor surcharge, and the configured tolerance allows the bill through
|
|
45
|
+
- **Quantity variance blocked**: The supplier invoices 100 units, but only 80 have been received under a 3-way match policy, so the bill is blocked pending additional receipt or correction
|
|
46
|
+
- **2-way matching for non-stock procurement**: A service purchase is matched only against the purchase order because warehouse receipt proof is not required by policy
|
|
47
|
+
- **Duplicate invoice prevention**: The same supplier invoice number is entered twice for one company and supplier, and the second attempt is rejected
|
|
48
|
+
- **Partial billing**: The supplier bills only the first shipment of a larger order; the matched quantity is recorded and the order remains open for later bills
|
|
49
|
+
- **Pre-AP cancellation**: A matched bill is discovered to contain the wrong supplier invoice reference before AP accepts it, so procurement cancels the bill and preserves the original comparison evidence
|
|
50
|
+
- **Credit or correction workflow precursor**: A supplier invoice is overbilled and blocked or cancelled, creating the basis for a future thin `PurchaseCreditNote` or bill-revision workflow without redesigning the `PurchaseBill` state machine
|
|
51
|
+
- **Payment-term inheritance**: The bill inherits the order's negotiated payment term so downstream AP sees the correct due dates and discount window
|
|
52
|
+
- **Tax snapshot capture**: The bill snapshots supplier tax identification, tax code, taxable amount, and tax amount so legal invoice validation survives later supplier-master edits
|
|
53
|
+
|
|
54
|
+
## Test Cases
|
|
55
|
+
|
|
56
|
+
- Creating a purchase bill with a valid supplier, company, and at least one bill line should succeed
|
|
57
|
+
- A purchase bill line must reference a valid purchase order line and a billed quantity greater than zero
|
|
58
|
+
- Duplicate supplier invoice numbers for the same supplier and company should be rejected
|
|
59
|
+
- A 2-way matched bill must compare billed quantity and price to the referenced purchase order line
|
|
60
|
+
- A 3-way matched bill must not approve a billed quantity greater than the cumulative posted receipt quantity, subject to configured tolerance
|
|
61
|
+
- A bill with a price variance above configured tolerance should be marked blocked rather than matched
|
|
62
|
+
- A bill matched to a cancelled purchase order should fail
|
|
63
|
+
- A matched bill must snapshot the supplier invoice date, external invoice number, ordered price reference, assigned payment term, supplier tax identifier, tax code, taxable amount, and tax amount
|
|
64
|
+
- Partial billing must increase the purchase order line billed quantity without forcing the order closed
|
|
65
|
+
- A supplier bill must not be considered ready for downstream AP until all required matching checks pass
|
|
66
|
+
- A matched or blocked bill may transition to `CANCELLED` only while no downstream AP or accounting module has accepted the payable handoff
|
|
67
|
+
- Cancelling a bill must preserve the original variance evidence and line references for future credit-note or dispute workflows
|
|
68
|
+
- Bills must be isolated by company and must not reference purchase orders from another company
|
|
69
|
+
- If a bill is blocked for variance, the variance reason and comparison basis should remain visible for review
|
|
70
|
+
- Matching logic must preserve whether the bill used 2-way or 3-way matching
|
|
71
|
+
- Only authorized procurement or AP users should be able to match, block, or release supplier bills
|
|
72
|
+
- A matched bill should expose the due-date schedule calculated from the assigned purchase payment term
|
|
73
|
+
- Editing supplier price rules after bill creation must not change the comparison baseline for an existing matched or blocked bill
|
|
74
|
+
|
|
75
|
+
## Reference Links
|
|
76
|
+
|
|
77
|
+
- [Odoo vendor bills and three-way matching](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/purchase/manage_deals/manage.html#vendor-bills)
|
|
78
|
+
- [Oracle invoice matching overview](https://docs.oracle.com/en/cloud/saas/financials/24c/fappp/invoice-matching.html)
|
|
79
|
+
- [SAP supplier invoice and invoice verification documentation](https://help.sap.com/docs/SAP_S4HANA_CLOUD)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Supplier Purchase Pricing
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Supplier Purchase Pricing manages the supplier-specific commercial rules that default onto purchase order lines. A `PurchasePriceList` groups one supplier's purchasable pricing conditions, while `PurchasePriceRule` defines the actual pricing logic for a given item or purchasing context, such as effective date, minimum quantity, currency, and unit of measure. These rules allow procurement teams to keep negotiated purchase prices in a structured, reusable form instead of entering them manually on every order.
|
|
6
|
+
|
|
7
|
+
The feature is intentionally procurement-specific rather than generic enterprise pricing. It focuses on "what do we expect to pay this supplier for this item under these conditions?" and provides deterministic price selection when buyers create or revise purchase orders. When the supplier's purchasing unit of measure differs from the item's stocking unit, this feature relies on conversion definitions owned by `primitives` rather than re-implementing unit-conversion logic in purchase. Blanket orders and release-against-contract pricing remain explicit non-goals for the MVP.
|
|
8
|
+
|
|
9
|
+
## Business Purpose
|
|
10
|
+
|
|
11
|
+
- Reduce manual entry by defaulting supplier-negotiated prices into purchase order lines
|
|
12
|
+
- Capture quantity breaks, date validity, and currency-specific supplier agreements
|
|
13
|
+
- Preserve commercial history by snapshotting the applied rule onto the purchase order at ordering time
|
|
14
|
+
- Support consistent purchasing across buyers, companies, and repeated replenishment cycles
|
|
15
|
+
- Make price variance detection possible when supplier bills arrive above or below the agreed purchase condition
|
|
16
|
+
- Separate procurement pricing from product definition and from downstream AP settlement logic
|
|
17
|
+
- Keep purchasing-UoM pricing compatible with stock-UoM receiving by delegating conversions to the shared unit-conversion capability
|
|
18
|
+
|
|
19
|
+
## Process Flow
|
|
20
|
+
|
|
21
|
+
```mermaid
|
|
22
|
+
flowchart TD
|
|
23
|
+
A[Create Purchase Price List] --> B[Add Purchase Price Rules]
|
|
24
|
+
B --> C[Set supplier, item scope, dates, quantity breaks]
|
|
25
|
+
C --> D[Activate list]
|
|
26
|
+
D --> E[Buyer creates PO line]
|
|
27
|
+
E --> F[Resolve applicable rules]
|
|
28
|
+
F --> G{Rule found?}
|
|
29
|
+
G -->|Yes| H[Apply best matching rule]
|
|
30
|
+
G -->|No| I[Manual price entry]
|
|
31
|
+
H --> J[Snapshot applied price and rule reference on PO line]
|
|
32
|
+
I --> J
|
|
33
|
+
J --> K[Order placed]
|
|
34
|
+
K --> L[Supplier bill matching compares invoice price to ordered price]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Scenario Patterns
|
|
38
|
+
|
|
39
|
+
- **Annual supplier contract**: A supplier price list is created for the fiscal year with negotiated base prices for each frequently purchased item
|
|
40
|
+
- **Quantity break pricing**: A supplier offers 10 currency per unit above 100 pieces and 9 currency per unit above 500 pieces; the applicable tier is selected automatically based on ordered quantity
|
|
41
|
+
- **Time-bounded promotion**: A temporary supplier discount is valid for one month. Orders placed within the effective range receive the temporary price, after which the normal rule applies again
|
|
42
|
+
- **Multi-currency purchasing**: The same supplier provides one item in USD and another in EUR; purchase price rules keep those commercial conditions separate and explicit
|
|
43
|
+
- **Supplier-specific UoM**: A supplier sells an item by carton while the item's internal base unit is piece; the purchase price rule is keyed to the purchasing UoM used on the PO
|
|
44
|
+
- **UoM conversion delegation**: A buyer orders in cartons while inventory receives in pieces. The purchase rule prices the carton, and purchase calls the shared unit-conversion definitions from `primitives` to derive receipt and variance comparisons consistently
|
|
45
|
+
- **One-time exception**: The system defaults the contracted price, but the buyer manually overrides it for a special order while retaining the original matched-rule reference for auditability
|
|
46
|
+
- **Rule retirement**: An old price list is deactivated when a new contract begins, preventing future orders from using obsolete supplier pricing
|
|
47
|
+
- **Price variance review**: The supplier invoice arrives above the ordered unit price, and the matched purchase price rule helps determine whether the variance is expected or should be blocked
|
|
48
|
+
|
|
49
|
+
## Test Cases
|
|
50
|
+
|
|
51
|
+
- Creating a purchase price list for an ACTIVE supplier with the SUPPLIER role should succeed
|
|
52
|
+
- A purchase price rule must require a positive unit price and a valid item or defined pricing scope
|
|
53
|
+
- A quantity-break rule must not allow a negative minimum quantity
|
|
54
|
+
- A rule with an effective end date earlier than its start date should fail validation
|
|
55
|
+
- Inactive price lists or inactive rules must not be selected for new purchase orders
|
|
56
|
+
- When multiple rules match the same PO line, rule resolution must follow deterministic precedence based on supplier, item scope, UoM, minimum quantity, date, and explicit priority
|
|
57
|
+
- When no rule matches a PO line, the system should allow manual pricing while marking the line as unmatched to a price rule
|
|
58
|
+
- Editing a price rule after a purchase order is placed must not retroactively change the ordered unit price on that existing order
|
|
59
|
+
- A purchase price list must be isolated by company when company-specific procurement data is required
|
|
60
|
+
- Duplicate rules with indistinguishable precedence for the same supplier, item, date, and quantity context should be rejected or warned
|
|
61
|
+
- A purchase price rule currency must reference a valid currency from the primitives module
|
|
62
|
+
- If a purchase price rule UoM differs from the item's stocking UoM, a valid conversion path from `primitives` must exist before the rule can be used operationally
|
|
63
|
+
- Only ACTIVE items should be assignable to newly created purchase price rules
|
|
64
|
+
- A buyer should be able to override a defaulted price on a draft order while retaining audit information about the default rule
|
|
65
|
+
- Supplier bill matching should be able to compare invoice price against the purchase order's snapshotted price even if the underlying rule is later deactivated
|
|
66
|
+
- Only authorized procurement users should be able to create, update, activate, or deactivate purchase price lists
|
|
67
|
+
|
|
68
|
+
## Reference Links
|
|
69
|
+
|
|
70
|
+
- [Odoo vendor price and blanket-order purchasing concepts](https://www.odoo.com/documentation/19.0/applications/inventory_and_mrp/purchase/manage_deals.html)
|
|
71
|
+
- [Oracle Fusion Cloud Procurement documentation](https://docs.oracle.com/en/cloud/saas/procurement/index.html)
|
|
72
|
+
- [SAP S/4HANA Cloud procurement documentation](https://help.sap.com/docs/SAP_S4HANA_CLOUD)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# GoodsReceipt
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
GoodsReceipt is the purchase-side confirmation that ordered goods or services were received from the supplier. It records one receipt event against one purchase order with one or more receipt lines, updates purchase-order receiving progress, and optionally emits a downstream inventory handoff for stock items.
|
|
6
|
+
|
|
7
|
+
The model intentionally separates procurement confirmation from warehouse execution. Purchase owns the fact that the supplier fulfilled part of the commitment; inventory owns the resulting stock movement and physical storage consequences.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Draft: createGoodsReceipt
|
|
20
|
+
Draft --> Draft: updateGoodsReceipt
|
|
21
|
+
Draft --> Posted: postGoodsReceipt
|
|
22
|
+
Draft --> Cancelled: cancelGoodsReceipt
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Command Definitions
|
|
26
|
+
|
|
27
|
+
- [createGoodsReceipt](../commands/CreateGoodsReceipt.md) - Create a draft receipt against open purchase-order lines
|
|
28
|
+
- [updateGoodsReceipt](../commands/UpdateGoodsReceipt.md) - Correct draft receipt quantities, dates, or line composition before posting
|
|
29
|
+
- [postGoodsReceipt](../commands/PostGoodsReceipt.md) - Validate tolerance, post the receipt, update order progress, and emit the inbound handoff
|
|
30
|
+
- [cancelGoodsReceipt](../commands/CancelGoodsReceipt.md) - Cancel a draft receipt before it affects purchase-order fulfillment
|
|
31
|
+
|
|
32
|
+
### Query Definitions
|
|
33
|
+
|
|
34
|
+
- [getGoodsReceipt](../queries/GetGoodsReceipt.md) - Retrieve a goods receipt with all receipt lines and handoff metadata
|
|
35
|
+
|
|
36
|
+
### Models
|
|
37
|
+
|
|
38
|
+
- GoodsReceipt
|
|
39
|
+
- GoodsReceiptLine
|
|
40
|
+
- InboundReceiptHandoff
|
|
41
|
+
|
|
42
|
+
### Invariants
|
|
43
|
+
|
|
44
|
+
- Every goods receipt belongs to exactly one company, one supplier, and one purchase order
|
|
45
|
+
- Every receipt line references one open purchase-order line and records a received quantity greater than zero
|
|
46
|
+
- Only `POSTED` receipts contribute to purchase-order received quantities and 3-way bill matching
|
|
47
|
+
- A receipt cannot post against a cancelled or closed purchase order
|
|
48
|
+
- Over-receipt beyond configured tolerance is invalid unless an explicit override path is recorded by policy
|
|
49
|
+
- Service or non-stock receipt lines do not require downstream warehouse execution even when the procurement receipt is posted
|
|
50
|
+
- Posted receipts are immutable; future corrections must use a compensating workflow instead of mutating receipt history in place
|
|
51
|
+
- The minimum `InboundReceiptHandoff` payload contains purchase-order reference, purchase-order-line reference, goods-receipt reference, received quantity, unit of measure, receipt date, destination site, and destination storage location when stock execution requires it
|
|
52
|
+
|
|
53
|
+
### Relationships
|
|
54
|
+
|
|
55
|
+
- **Belongs To PurchaseOrder**: Each receipt posts against one [PurchaseOrder](./PurchaseOrder.md)
|
|
56
|
+
- **Has Many GoodsReceiptLines**: Each receipt contains one or more line-level receipt confirmations
|
|
57
|
+
- **References Item**: Receipt lines trace back to one [Item](../../../item-management/docs/models/Item.md) through the purchase-order line
|
|
58
|
+
- **May Emit InboundReceiptHandoff**: Posted stock receipts hand off to inventory execution using [CreateStockMovement](../../../inventory/docs/commands/CreateStockMovement.md) or an equivalent downstream adapter
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# PurchaseBill
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
PurchaseBill captures a supplier invoice inside the purchase domain until procurement matching is complete. It compares supplier-invoiced quantities, prices, and tax information against purchase-order commitments and, when required, posted goods receipts. The bill is then marked matched, blocked for variance, or cancelled before downstream AP acceptance.
|
|
6
|
+
|
|
7
|
+
The purchase bill also owns the procurement-side payable readiness contract. Once a bill is matched, purchase can hand downstream modules a stable `BillReadyHandoff` payload containing the invoice identity, matched amounts, due schedule, and tax snapshot.
|
|
8
|
+
|
|
9
|
+
## Domain Model Definitions
|
|
10
|
+
|
|
11
|
+
### Model type
|
|
12
|
+
|
|
13
|
+
Stateful
|
|
14
|
+
|
|
15
|
+
#### State Transitions
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
stateDiagram-v2
|
|
19
|
+
[*] --> Draft: createPurchaseBill
|
|
20
|
+
Draft --> Draft: updatePurchaseBill
|
|
21
|
+
Draft --> Blocked: matchPurchaseBill
|
|
22
|
+
Draft --> Matched: matchPurchaseBill
|
|
23
|
+
Blocked --> Matched: releasePurchaseBill
|
|
24
|
+
Draft --> Cancelled: cancelPurchaseBill
|
|
25
|
+
Blocked --> Cancelled: cancelPurchaseBill
|
|
26
|
+
Matched --> Cancelled: cancelPurchaseBill
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Command Definitions
|
|
30
|
+
|
|
31
|
+
- [createPurchaseBill](../commands/CreatePurchaseBill.md) - Create a draft supplier bill with invoice identity and line references
|
|
32
|
+
- [updatePurchaseBill](../commands/UpdatePurchaseBill.md) - Revise a draft bill before procurement matching is finalized
|
|
33
|
+
- [matchPurchaseBill](../commands/MatchPurchaseBill.md) - Run 2-way or 3-way matching and set the bill to matched or blocked
|
|
34
|
+
- [releasePurchaseBill](../commands/ReleasePurchaseBill.md) - Move a blocked bill to matched after authorized variance resolution
|
|
35
|
+
- [cancelPurchaseBill](../commands/CancelPurchaseBill.md) - Cancel a draft, blocked, or matched bill before downstream AP accepts the handoff
|
|
36
|
+
|
|
37
|
+
### Query Definitions
|
|
38
|
+
|
|
39
|
+
- [getPurchaseBill](../queries/GetPurchaseBill.md) - Retrieve a supplier bill with matching results, snapshots, and line references
|
|
40
|
+
- [calculatePurchaseBillDueSchedule](../queries/CalculatePurchaseBillDueSchedule.md) - Compute the downstream payable schedule from the bill's payment-term snapshot
|
|
41
|
+
|
|
42
|
+
### Models
|
|
43
|
+
|
|
44
|
+
- PurchaseBill
|
|
45
|
+
- PurchaseBillLine
|
|
46
|
+
- PurchaseBillTaxSnapshot
|
|
47
|
+
- BillReadyHandoff
|
|
48
|
+
|
|
49
|
+
### Invariants
|
|
50
|
+
|
|
51
|
+
- Every purchase bill belongs to exactly one company and one supplier
|
|
52
|
+
- Supplier invoice number is unique within one company and supplier combination
|
|
53
|
+
- Every bill line references at least one purchase-order line and records billed quantity greater than zero
|
|
54
|
+
- `MATCHED` bills preserve the comparison baseline: invoice date, invoice number, ordered price reference, payment-term snapshot, supplier tax identifier, tax code, taxable amount, and tax amount
|
|
55
|
+
- A 3-way match cannot mark a bill as matched when billed quantity exceeds cumulative posted receipt quantity beyond tolerance
|
|
56
|
+
- `BLOCKED` bills must preserve the variance reason and comparison basis for review
|
|
57
|
+
- `CANCELLED` is allowed only while no downstream AP or accounting module has accepted the `BillReadyHandoff`
|
|
58
|
+
- 4-way matching is explicitly out of scope for this module plan; quality evidence can be added as a future extension without redesigning the bill lifecycle
|
|
59
|
+
- Credit-note and debit-memo workflows are future extensions that must preserve the original bill evidence rather than rewriting it
|
|
60
|
+
|
|
61
|
+
### Relationships
|
|
62
|
+
|
|
63
|
+
- **Belongs To BusinessPartner**: Each bill references one supplier [BusinessPartner](../../../business-partner/docs/models/BusinessPartner.md)
|
|
64
|
+
- **References PurchaseOrder**: Bill lines match against one or more [PurchaseOrder](./PurchaseOrder.md) lines
|
|
65
|
+
- **References GoodsReceipt**: 3-way matching may compare against posted [GoodsReceipt](./GoodsReceipt.md) lines
|
|
66
|
+
- **Snapshots PurchasePaymentTerm**: The bill carries a [PurchasePaymentTerm](./PurchasePaymentTerm.md) snapshot and calculated due schedule
|
|
67
|
+
- **Snapshots PartnerIdentification**: The bill stores supplier tax identity from [PartnerIdentification](../../../business-partner/docs/models/PartnerIdentification.md)
|
|
68
|
+
- **May Emit BillReadyHandoff**: Matched bills hand off invoice reference, matched amounts, due schedule, tax snapshot, and matching mode to downstream AP or accounting
|