@tailor-platform/erp-kit 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1402) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +12 -12
  3. package/dist/cli.mjs +476 -29
  4. package/package.json +2 -11
  5. package/skills/erp-kit-app-1-requirements/SKILL.md +31 -3
  6. package/skills/{erp-kit-app-3-plan → erp-kit-app-1-requirements}/references/story-extraction.md +3 -9
  7. package/skills/erp-kit-app-2-requirements-review/SKILL.md +31 -7
  8. package/skills/erp-kit-app-2-requirements-review/references/best-practices-check.md +1 -1
  9. package/skills/erp-kit-app-2-requirements-review/references/story-quality-check.md +67 -0
  10. package/skills/erp-kit-app-3-plan/SKILL.md +33 -32
  11. package/skills/erp-kit-app-3-plan/references/resolver-extraction.md +10 -5
  12. package/skills/erp-kit-app-3-plan/references/screen-extraction.md +5 -3
  13. package/skills/erp-kit-app-4-plan-review/SKILL.md +19 -14
  14. package/skills/erp-kit-app-4-plan-review/references/orphan-detection.md +3 -0
  15. package/skills/erp-kit-app-4-plan-review/references/story-resolver-parity.md +21 -3
  16. package/skills/erp-kit-app-5-impl-backend/SKILL.md +22 -3
  17. package/skills/erp-kit-app-6-impl-frontend/SKILL.md +19 -4
  18. package/skills/erp-kit-app-7-impl-review/SKILL.md +19 -15
  19. package/skills/erp-kit-app-shared/references/resolver-classification.md +3 -0
  20. package/skills/erp-kit-module-2-requirements-review/SKILL.md +17 -36
  21. package/skills/erp-kit-module-3-update-plan/SKILL.md +132 -0
  22. package/skills/erp-kit-module-3-update-plan/references/command-extraction.md +87 -0
  23. package/skills/erp-kit-module-3-update-plan/references/model-extraction.md +72 -0
  24. package/skills/erp-kit-module-3-update-plan/references/naming.md +73 -0
  25. package/skills/erp-kit-module-3-update-plan/references/query-extraction.md +59 -0
  26. package/skills/erp-kit-module-4-plan-review/SKILL.md +17 -76
  27. package/skills/erp-kit-module-5-impl/SKILL.md +1 -0
  28. package/skills/erp-kit-module-6-impl-review/SKILL.md +42 -120
  29. package/skills/erp-kit-module-6-impl-review/references/command-doc-test-parity.md +1 -1
  30. package/skills/erp-kit-module-6-impl-review/references/{error-implementation-parity.md → command-error-implementation-parity.md} +3 -3
  31. package/skills/erp-kit-module-6-impl-review/references/impl-parity-report-format.md +1 -1
  32. package/skills/erp-kit-module-6-impl-review/references/query-doc-code-parity.md +110 -0
  33. package/skills/erp-kit-module-6-impl-review/references/query-doc-test-parity.md +108 -0
  34. package/skills/erp-kit-module-6-impl-review/references/query-error-implementation-parity.md +100 -0
  35. package/skills/erp-kit-module-shared/references/commands.md +1 -1
  36. package/skills/erp-kit-module-shared/references/queries.md +5 -6
  37. package/src/commands/app/index.ts +18 -3
  38. package/src/commands/check.test.ts +1 -1
  39. package/src/commands/doc/module.ts +2 -3
  40. package/src/commands/doc/modules.test.ts +0 -7
  41. package/src/commands/doc/modules.ts +1 -2
  42. package/src/commands/doc/search.ts +1 -2
  43. package/src/commands/init.ts +4 -0
  44. package/src/commands/lib/distribute.test.ts +32 -1
  45. package/src/commands/lib/distribute.ts +47 -5
  46. package/src/commands/lib/sync-check-source.test.ts +1 -1
  47. package/src/commands/update.test.ts +16 -0
  48. package/src/commands/update.ts +4 -1
  49. package/src/generator/generate-code-boilerplate.test.ts +0 -1
  50. package/src/generator/generate-code.test.ts +10 -6
  51. package/src/generator/generate-errors.ts +1 -1
  52. package/src/generator/generate-permissions.ts +1 -1
  53. package/src/generator/generate-seed.ts +69 -0
  54. package/src/generator/generate-shells.ts +2 -2
  55. package/src/generator/stub-templates.ts +5 -5
  56. package/src/module.ts +59 -0
  57. package/src/modules/audit/command/activateAuditPolicy.generated.ts +1 -1
  58. package/src/modules/audit/command/activateAuditPolicy.test.ts +1 -1
  59. package/src/modules/audit/command/activateAuditPolicy.ts +1 -1
  60. package/src/modules/audit/command/createAuditPolicy.generated.ts +1 -1
  61. package/src/modules/audit/command/createAuditPolicy.test.ts +1 -1
  62. package/src/modules/audit/command/createAuditPolicy.ts +1 -1
  63. package/src/modules/audit/command/deactivateAuditPolicy.generated.ts +1 -1
  64. package/src/modules/audit/command/deactivateAuditPolicy.test.ts +2 -2
  65. package/src/modules/audit/command/deactivateAuditPolicy.ts +1 -1
  66. package/src/modules/audit/command/deleteAuditPolicy.generated.ts +1 -1
  67. package/src/modules/audit/command/deleteAuditPolicy.test.ts +1 -1
  68. package/src/modules/audit/command/deleteAuditPolicy.ts +1 -1
  69. package/src/modules/audit/command/logAuditEvent.generated.ts +1 -1
  70. package/src/modules/audit/command/logAuditEvent.test.ts +1 -1
  71. package/src/modules/audit/command/logAuditEvent.ts +1 -1
  72. package/src/modules/audit/command/reactivateAuditPolicy.generated.ts +1 -1
  73. package/src/modules/audit/command/reactivateAuditPolicy.test.ts +2 -2
  74. package/src/modules/audit/command/reactivateAuditPolicy.ts +1 -1
  75. package/src/modules/audit/command/registerAuditableEntity.generated.ts +1 -1
  76. package/src/modules/audit/command/registerAuditableEntity.test.ts +1 -1
  77. package/src/modules/audit/command/registerAuditableEntity.ts +1 -1
  78. package/src/modules/audit/command/replaceAuditPolicy.generated.ts +1 -1
  79. package/src/modules/audit/command/replaceAuditPolicy.test.ts +1 -1
  80. package/src/modules/audit/command/replaceAuditPolicy.ts +1 -1
  81. package/src/modules/audit/command/updateAuditPolicy.generated.ts +1 -1
  82. package/src/modules/audit/command/updateAuditPolicy.test.ts +1 -1
  83. package/src/modules/audit/command/updateAuditPolicy.ts +1 -1
  84. package/src/modules/audit/lib/errors.generated.ts +1 -1
  85. package/src/modules/audit/lib/permissions.generated.ts +1 -1
  86. package/src/modules/audit/lib/types.ts +6 -1
  87. package/src/modules/audit/permissions.ts +1 -1
  88. package/src/modules/audit/query/getAuditEntry.generated.ts +1 -1
  89. package/src/modules/audit/query/getAuditEntry.test.ts +2 -2
  90. package/src/modules/audit/query/getAuditEntry.ts +7 -1
  91. package/src/modules/audit/query/getAuditPolicy.generated.ts +1 -1
  92. package/src/modules/audit/query/getAuditPolicy.test.ts +2 -2
  93. package/src/modules/audit/query/getAuditPolicy.ts +7 -1
  94. package/src/modules/audit/query/getAuditSummary.generated.ts +1 -1
  95. package/src/modules/audit/query/getAuditSummary.test.ts +2 -2
  96. package/src/modules/audit/query/getAuditSummary.ts +7 -1
  97. package/src/modules/audit/query/getChangeDetails.generated.ts +1 -1
  98. package/src/modules/audit/query/getChangeDetails.test.ts +2 -2
  99. package/src/modules/audit/query/getChangeDetails.ts +7 -1
  100. package/src/modules/audit/query/listAuditPolicies.generated.ts +1 -1
  101. package/src/modules/audit/query/listAuditPolicies.test.ts +2 -2
  102. package/src/modules/audit/query/listAuditPolicies.ts +3 -3
  103. package/src/modules/audit/query/searchAuditEntries.generated.ts +1 -1
  104. package/src/modules/audit/query/searchAuditEntries.test.ts +2 -2
  105. package/src/modules/audit/query/searchAuditEntries.ts +7 -7
  106. package/src/modules/business-partner/README.md +2 -2
  107. package/src/modules/business-partner/command/activatePartner.generated.ts +1 -1
  108. package/src/modules/business-partner/command/activatePartner.ts +1 -1
  109. package/src/modules/business-partner/command/assignRoleToPartner.generated.ts +1 -1
  110. package/src/modules/business-partner/command/assignRoleToPartner.test.ts +1 -1
  111. package/src/modules/business-partner/command/assignRoleToPartner.ts +1 -1
  112. package/src/modules/business-partner/command/createContactPerson.generated.ts +1 -1
  113. package/src/modules/business-partner/command/createContactPerson.ts +1 -1
  114. package/src/modules/business-partner/command/createPartner.generated.ts +1 -1
  115. package/src/modules/business-partner/command/createPartner.test.ts +1 -1
  116. package/src/modules/business-partner/command/createPartner.ts +3 -4
  117. package/src/modules/business-partner/command/createPartnerAddress.generated.ts +1 -1
  118. package/src/modules/business-partner/command/createPartnerAddress.ts +1 -1
  119. package/src/modules/business-partner/command/createPartnerBankAccount.generated.ts +1 -1
  120. package/src/modules/business-partner/command/createPartnerBankAccount.test.ts +1 -1
  121. package/src/modules/business-partner/command/createPartnerBankAccount.ts +1 -1
  122. package/src/modules/business-partner/command/createPartnerIdentification.generated.ts +1 -1
  123. package/src/modules/business-partner/command/createPartnerIdentification.test.ts +1 -1
  124. package/src/modules/business-partner/command/createPartnerIdentification.ts +1 -1
  125. package/src/modules/business-partner/command/deactivateContactPerson.generated.ts +1 -1
  126. package/src/modules/business-partner/command/deactivateContactPerson.ts +1 -1
  127. package/src/modules/business-partner/command/deactivatePartner.generated.ts +1 -1
  128. package/src/modules/business-partner/command/deactivatePartner.ts +1 -1
  129. package/src/modules/business-partner/command/deleteContactPerson.generated.ts +1 -1
  130. package/src/modules/business-partner/command/deleteContactPerson.ts +1 -1
  131. package/src/modules/business-partner/command/deletePartner.generated.ts +1 -1
  132. package/src/modules/business-partner/command/deletePartner.ts +1 -1
  133. package/src/modules/business-partner/command/deletePartnerAddress.generated.ts +1 -1
  134. package/src/modules/business-partner/command/deletePartnerAddress.test.ts +1 -1
  135. package/src/modules/business-partner/command/deletePartnerAddress.ts +1 -1
  136. package/src/modules/business-partner/command/deletePartnerBankAccount.generated.ts +1 -1
  137. package/src/modules/business-partner/command/deletePartnerBankAccount.test.ts +1 -1
  138. package/src/modules/business-partner/command/deletePartnerBankAccount.ts +1 -1
  139. package/src/modules/business-partner/command/deletePartnerIdentification.generated.ts +1 -1
  140. package/src/modules/business-partner/command/deletePartnerIdentification.test.ts +1 -1
  141. package/src/modules/business-partner/command/deletePartnerIdentification.ts +1 -1
  142. package/src/modules/business-partner/command/reactivateContactPerson.generated.ts +1 -1
  143. package/src/modules/business-partner/command/reactivateContactPerson.ts +1 -1
  144. package/src/modules/business-partner/command/reactivatePartner.generated.ts +1 -1
  145. package/src/modules/business-partner/command/reactivatePartner.ts +1 -1
  146. package/src/modules/business-partner/command/removeRoleFromPartner.generated.ts +1 -1
  147. package/src/modules/business-partner/command/removeRoleFromPartner.test.ts +1 -1
  148. package/src/modules/business-partner/command/removeRoleFromPartner.ts +1 -1
  149. package/src/modules/business-partner/command/setDefaultPartnerAddress.generated.ts +1 -1
  150. package/src/modules/business-partner/command/setDefaultPartnerAddress.ts +1 -1
  151. package/src/modules/business-partner/command/setDefaultPartnerBankAccount.generated.ts +1 -1
  152. package/src/modules/business-partner/command/setDefaultPartnerBankAccount.test.ts +1 -1
  153. package/src/modules/business-partner/command/setDefaultPartnerBankAccount.ts +1 -1
  154. package/src/modules/business-partner/command/setPrimaryContactPerson.generated.ts +1 -1
  155. package/src/modules/business-partner/command/setPrimaryContactPerson.ts +1 -1
  156. package/src/modules/business-partner/command/updateContactPerson.generated.ts +1 -1
  157. package/src/modules/business-partner/command/updateContactPerson.ts +1 -1
  158. package/src/modules/business-partner/command/updatePartner.generated.ts +1 -1
  159. package/src/modules/business-partner/command/updatePartner.test.ts +1 -1
  160. package/src/modules/business-partner/command/updatePartner.ts +1 -1
  161. package/src/modules/business-partner/command/updatePartnerAddress.generated.ts +1 -1
  162. package/src/modules/business-partner/command/updatePartnerAddress.ts +1 -1
  163. package/src/modules/business-partner/command/updatePartnerBankAccount.generated.ts +1 -1
  164. package/src/modules/business-partner/command/updatePartnerBankAccount.test.ts +1 -1
  165. package/src/modules/business-partner/command/updatePartnerBankAccount.ts +1 -1
  166. package/src/modules/business-partner/command/updatePartnerIdentification.generated.ts +1 -1
  167. package/src/modules/business-partner/command/updatePartnerIdentification.test.ts +1 -1
  168. package/src/modules/business-partner/command/updatePartnerIdentification.ts +1 -1
  169. package/src/modules/business-partner/lib/errors.generated.ts +1 -1
  170. package/src/modules/business-partner/lib/permissions.generated.ts +1 -1
  171. package/src/modules/business-partner/lib/types.ts +6 -1
  172. package/src/modules/business-partner/module.ts +1 -1
  173. package/src/modules/business-partner/permissions.ts +1 -1
  174. package/src/modules/business-partner/query/getContactPerson.generated.ts +1 -1
  175. package/src/modules/business-partner/query/getContactPerson.ts +1 -1
  176. package/src/modules/business-partner/query/getDefaultPartnerAddress.generated.ts +1 -1
  177. package/src/modules/business-partner/query/getDefaultPartnerAddress.ts +1 -1
  178. package/src/modules/business-partner/query/getDefaultPartnerBankAccount.generated.ts +1 -1
  179. package/src/modules/business-partner/query/getDefaultPartnerBankAccount.ts +1 -1
  180. package/src/modules/business-partner/query/getPartner.generated.ts +1 -1
  181. package/src/modules/business-partner/query/getPartner.ts +1 -1
  182. package/src/modules/business-partner/query/getPartnerAddress.generated.ts +1 -1
  183. package/src/modules/business-partner/query/getPartnerAddress.ts +1 -1
  184. package/src/modules/business-partner/query/getPartnerBankAccount.generated.ts +1 -1
  185. package/src/modules/business-partner/query/getPartnerBankAccount.ts +1 -1
  186. package/src/modules/business-partner/query/getPartnerIdentification.generated.ts +1 -1
  187. package/src/modules/business-partner/query/getPartnerIdentification.ts +1 -1
  188. package/src/modules/business-partner/query/getPartnerRole.generated.ts +1 -1
  189. package/src/modules/business-partner/query/getPartnerRole.ts +1 -1
  190. package/src/modules/business-partner/query/getPrimaryContactPerson.generated.ts +1 -1
  191. package/src/modules/business-partner/query/getPrimaryContactPerson.ts +1 -1
  192. package/src/modules/business-partner/query/listContactPersonsByPartner.generated.ts +1 -1
  193. package/src/modules/business-partner/query/listContactPersonsByPartner.ts +2 -2
  194. package/src/modules/business-partner/query/listPartnerAddressesByPartner.generated.ts +1 -1
  195. package/src/modules/business-partner/query/listPartnerAddressesByPartner.ts +3 -3
  196. package/src/modules/business-partner/query/listPartnerBankAccountsByPartner.generated.ts +1 -1
  197. package/src/modules/business-partner/query/listPartnerBankAccountsByPartner.ts +2 -2
  198. package/src/modules/business-partner/query/listPartnerIdentificationsByPartner.generated.ts +1 -1
  199. package/src/modules/business-partner/query/listPartnerIdentificationsByPartner.ts +3 -3
  200. package/src/modules/business-partner/query/listPartnersByRole.generated.ts +1 -1
  201. package/src/modules/business-partner/query/listPartnersByRole.ts +4 -4
  202. package/src/modules/coa-management/command/activateAccount.generated.ts +1 -1
  203. package/src/modules/coa-management/command/activateAccount.test.ts +1 -1
  204. package/src/modules/coa-management/command/activateAccount.ts +1 -1
  205. package/src/modules/coa-management/command/activateChartOfAccounts.generated.ts +1 -1
  206. package/src/modules/coa-management/command/activateChartOfAccounts.test.ts +1 -1
  207. package/src/modules/coa-management/command/activateChartOfAccounts.ts +1 -1
  208. package/src/modules/coa-management/command/createAccount.generated.ts +1 -1
  209. package/src/modules/coa-management/command/createAccount.test.ts +1 -1
  210. package/src/modules/coa-management/command/createAccount.ts +1 -1
  211. package/src/modules/coa-management/command/createAccountGroup.generated.ts +1 -1
  212. package/src/modules/coa-management/command/createAccountGroup.test.ts +1 -1
  213. package/src/modules/coa-management/command/createAccountGroup.ts +1 -1
  214. package/src/modules/coa-management/command/createChartOfAccounts.generated.ts +1 -1
  215. package/src/modules/coa-management/command/createChartOfAccounts.test.ts +1 -1
  216. package/src/modules/coa-management/command/createChartOfAccounts.ts +1 -1
  217. package/src/modules/coa-management/command/deactivateAccount.generated.ts +1 -1
  218. package/src/modules/coa-management/command/deactivateAccount.test.ts +1 -1
  219. package/src/modules/coa-management/command/deactivateAccount.ts +1 -1
  220. package/src/modules/coa-management/command/deactivateChartOfAccounts.generated.ts +1 -1
  221. package/src/modules/coa-management/command/deactivateChartOfAccounts.test.ts +1 -1
  222. package/src/modules/coa-management/command/deactivateChartOfAccounts.ts +1 -1
  223. package/src/modules/coa-management/command/deleteAccount.generated.ts +1 -1
  224. package/src/modules/coa-management/command/deleteAccount.test.ts +1 -1
  225. package/src/modules/coa-management/command/deleteAccount.ts +1 -1
  226. package/src/modules/coa-management/command/deleteAccountGroup.generated.ts +1 -1
  227. package/src/modules/coa-management/command/deleteAccountGroup.test.ts +1 -1
  228. package/src/modules/coa-management/command/deleteAccountGroup.ts +1 -1
  229. package/src/modules/coa-management/command/deleteChartOfAccounts.generated.ts +1 -1
  230. package/src/modules/coa-management/command/deleteChartOfAccounts.test.ts +1 -1
  231. package/src/modules/coa-management/command/deleteChartOfAccounts.ts +1 -1
  232. package/src/modules/coa-management/command/moveAccountGroup.generated.ts +1 -1
  233. package/src/modules/coa-management/command/moveAccountGroup.test.ts +1 -1
  234. package/src/modules/coa-management/command/moveAccountGroup.ts +1 -1
  235. package/src/modules/coa-management/command/reactivateAccount.generated.ts +1 -1
  236. package/src/modules/coa-management/command/reactivateAccount.test.ts +1 -1
  237. package/src/modules/coa-management/command/reactivateAccount.ts +1 -1
  238. package/src/modules/coa-management/command/updateAccount.generated.ts +1 -1
  239. package/src/modules/coa-management/command/updateAccount.test.ts +1 -1
  240. package/src/modules/coa-management/command/updateAccount.ts +1 -1
  241. package/src/modules/coa-management/command/updateAccountGroup.generated.ts +1 -1
  242. package/src/modules/coa-management/command/updateAccountGroup.test.ts +1 -1
  243. package/src/modules/coa-management/command/updateAccountGroup.ts +1 -1
  244. package/src/modules/coa-management/command/updateChartOfAccounts.generated.ts +1 -1
  245. package/src/modules/coa-management/command/updateChartOfAccounts.test.ts +1 -1
  246. package/src/modules/coa-management/command/updateChartOfAccounts.ts +1 -1
  247. package/src/modules/coa-management/lib/errors.generated.ts +1 -1
  248. package/src/modules/coa-management/lib/permissions.generated.ts +1 -1
  249. package/src/modules/coa-management/lib/types.ts +6 -1
  250. package/src/modules/coa-management/module.ts +1 -1
  251. package/src/modules/coa-management/permissions.ts +1 -1
  252. package/src/modules/coa-management/query/detectCircularReference.generated.ts +1 -1
  253. package/src/modules/coa-management/query/detectCircularReference.ts +1 -1
  254. package/src/modules/coa-management/query/getAccount.generated.ts +1 -1
  255. package/src/modules/coa-management/query/getAccount.ts +1 -1
  256. package/src/modules/coa-management/query/getAccountGroup.generated.ts +1 -1
  257. package/src/modules/coa-management/query/getAccountGroup.ts +1 -1
  258. package/src/modules/coa-management/query/getChartOfAccounts.generated.ts +1 -1
  259. package/src/modules/coa-management/query/getChartOfAccounts.ts +1 -1
  260. package/src/modules/coa-management/query/listAccountGroups.generated.ts +1 -1
  261. package/src/modules/coa-management/query/listAccountGroups.ts +2 -2
  262. package/src/modules/coa-management/query/listAccounts.generated.ts +1 -1
  263. package/src/modules/coa-management/query/listAccounts.ts +3 -3
  264. package/src/modules/coa-management/query/listUnassignedAccounts.generated.ts +1 -1
  265. package/src/modules/coa-management/query/listUnassignedAccounts.ts +2 -2
  266. package/src/modules/inventory/README.md +65 -0
  267. package/src/modules/inventory/command/approveCountLine.generated.ts +6 -0
  268. package/src/modules/inventory/command/approveCountLine.test.ts +89 -0
  269. package/src/modules/inventory/command/approveCountLine.ts +68 -0
  270. package/src/modules/inventory/command/approveInventoryAdjustment.generated.ts +6 -0
  271. package/src/modules/inventory/command/approveInventoryAdjustment.test.ts +56 -0
  272. package/src/modules/inventory/command/approveInventoryAdjustment.ts +50 -0
  273. package/src/modules/inventory/command/assignSerialNumber.generated.ts +6 -0
  274. package/src/modules/inventory/command/assignSerialNumber.test.ts +133 -0
  275. package/src/modules/inventory/command/assignSerialNumber.ts +83 -0
  276. package/src/modules/inventory/command/cancelInventoryCount.generated.ts +6 -0
  277. package/src/modules/inventory/command/cancelInventoryCount.test.ts +114 -0
  278. package/src/modules/inventory/command/cancelInventoryCount.ts +62 -0
  279. package/src/modules/inventory/command/cancelStockMovement.generated.ts +6 -0
  280. package/src/modules/inventory/command/cancelStockMovement.test.ts +102 -0
  281. package/src/modules/inventory/command/cancelStockMovement.ts +56 -0
  282. package/src/modules/inventory/command/completeInventoryCount.generated.ts +6 -0
  283. package/src/modules/inventory/command/completeInventoryCount.test.ts +99 -0
  284. package/src/modules/inventory/command/completeInventoryCount.ts +70 -0
  285. package/src/modules/inventory/command/confirmInventoryAdjustment.generated.ts +6 -0
  286. package/src/modules/inventory/command/confirmInventoryAdjustment.test.ts +324 -0
  287. package/src/modules/inventory/command/confirmInventoryAdjustment.ts +194 -0
  288. package/src/modules/inventory/command/confirmStockMovement.generated.ts +6 -0
  289. package/src/modules/inventory/command/confirmStockMovement.test.ts +126 -0
  290. package/src/modules/inventory/command/confirmStockMovement.ts +131 -0
  291. package/src/modules/inventory/command/createInventoryAdjustment.generated.ts +6 -0
  292. package/src/modules/inventory/command/createInventoryAdjustment.test.ts +298 -0
  293. package/src/modules/inventory/command/createInventoryAdjustment.ts +124 -0
  294. package/src/modules/inventory/command/createInventoryCount.generated.ts +6 -0
  295. package/src/modules/inventory/command/createInventoryCount.test.ts +157 -0
  296. package/src/modules/inventory/command/createInventoryCount.ts +72 -0
  297. package/src/modules/inventory/command/createLot.generated.ts +6 -0
  298. package/src/modules/inventory/command/createLot.test.ts +106 -0
  299. package/src/modules/inventory/command/createLot.ts +72 -0
  300. package/src/modules/inventory/command/createStockMovement.generated.ts +6 -0
  301. package/src/modules/inventory/command/createStockMovement.test.ts +342 -0
  302. package/src/modules/inventory/command/createStockMovement.ts +172 -0
  303. package/src/modules/inventory/command/createStorageLocation.generated.ts +6 -0
  304. package/src/modules/inventory/command/createStorageLocation.test.ts +246 -0
  305. package/src/modules/inventory/command/createStorageLocation.ts +126 -0
  306. package/src/modules/inventory/command/createValuationPolicy.generated.ts +6 -0
  307. package/src/modules/inventory/command/createValuationPolicy.test.ts +75 -0
  308. package/src/modules/inventory/command/createValuationPolicy.ts +52 -0
  309. package/src/modules/inventory/command/createWarehouse.generated.ts +6 -0
  310. package/src/modules/inventory/command/createWarehouse.test.ts +143 -0
  311. package/src/modules/inventory/command/createWarehouse.ts +76 -0
  312. package/src/modules/inventory/command/deactivateStorageLocation.generated.ts +6 -0
  313. package/src/modules/inventory/command/deactivateStorageLocation.test.ts +69 -0
  314. package/src/modules/inventory/command/deactivateStorageLocation.ts +51 -0
  315. package/src/modules/inventory/command/deactivateWarehouse.generated.ts +6 -0
  316. package/src/modules/inventory/command/deactivateWarehouse.test.ts +75 -0
  317. package/src/modules/inventory/command/deactivateWarehouse.ts +45 -0
  318. package/src/modules/inventory/command/executeStockMovement.generated.ts +6 -0
  319. package/src/modules/inventory/command/executeStockMovement.test.ts +502 -0
  320. package/src/modules/inventory/command/executeStockMovement.ts +303 -0
  321. package/src/modules/inventory/command/reactivateStorageLocation.generated.ts +6 -0
  322. package/src/modules/inventory/command/reactivateStorageLocation.test.ts +78 -0
  323. package/src/modules/inventory/command/reactivateStorageLocation.ts +63 -0
  324. package/src/modules/inventory/command/reactivateWarehouse.generated.ts +6 -0
  325. package/src/modules/inventory/command/reactivateWarehouse.test.ts +87 -0
  326. package/src/modules/inventory/command/reactivateWarehouse.ts +65 -0
  327. package/src/modules/inventory/command/recordCountLine.generated.ts +6 -0
  328. package/src/modules/inventory/command/recordCountLine.test.ts +211 -0
  329. package/src/modules/inventory/command/recordCountLine.ts +81 -0
  330. package/src/modules/inventory/command/rejectCountLine.generated.ts +6 -0
  331. package/src/modules/inventory/command/rejectCountLine.test.ts +66 -0
  332. package/src/modules/inventory/command/rejectCountLine.ts +50 -0
  333. package/src/modules/inventory/command/rejectInventoryAdjustment.generated.ts +6 -0
  334. package/src/modules/inventory/command/rejectInventoryAdjustment.test.ts +69 -0
  335. package/src/modules/inventory/command/rejectInventoryAdjustment.ts +50 -0
  336. package/src/modules/inventory/command/releaseReservation.generated.ts +6 -0
  337. package/src/modules/inventory/command/releaseReservation.test.ts +65 -0
  338. package/src/modules/inventory/command/releaseReservation.ts +50 -0
  339. package/src/modules/inventory/command/reserveStock.generated.ts +6 -0
  340. package/src/modules/inventory/command/reserveStock.test.ts +141 -0
  341. package/src/modules/inventory/command/reserveStock.ts +88 -0
  342. package/src/modules/inventory/command/reviseInventoryAdjustment.generated.ts +6 -0
  343. package/src/modules/inventory/command/reviseInventoryAdjustment.test.ts +68 -0
  344. package/src/modules/inventory/command/reviseInventoryAdjustment.ts +48 -0
  345. package/src/modules/inventory/command/startInventoryCount.generated.ts +6 -0
  346. package/src/modules/inventory/command/startInventoryCount.test.ts +100 -0
  347. package/src/modules/inventory/command/startInventoryCount.ts +90 -0
  348. package/src/modules/inventory/command/submitInventoryAdjustment.generated.ts +6 -0
  349. package/src/modules/inventory/command/submitInventoryAdjustment.test.ts +53 -0
  350. package/src/modules/inventory/command/submitInventoryAdjustment.ts +47 -0
  351. package/src/modules/inventory/command/updateLot.generated.ts +6 -0
  352. package/src/modules/inventory/command/updateLot.test.ts +88 -0
  353. package/src/modules/inventory/command/updateLot.ts +52 -0
  354. package/src/modules/inventory/command/updateStockMovement.generated.ts +6 -0
  355. package/src/modules/inventory/command/updateStockMovement.test.ts +250 -0
  356. package/src/modules/inventory/command/updateStockMovement.ts +164 -0
  357. package/src/modules/inventory/command/updateStorageLocation.generated.ts +6 -0
  358. package/src/modules/inventory/command/updateStorageLocation.test.ts +72 -0
  359. package/src/modules/inventory/command/updateStorageLocation.ts +77 -0
  360. package/src/modules/inventory/command/updateValuationPolicy.generated.ts +6 -0
  361. package/src/modules/inventory/command/updateValuationPolicy.test.ts +68 -0
  362. package/src/modules/inventory/command/updateValuationPolicy.ts +74 -0
  363. package/src/modules/inventory/command/updateWarehouse.generated.ts +6 -0
  364. package/src/modules/inventory/command/updateWarehouse.test.ts +88 -0
  365. package/src/modules/inventory/command/updateWarehouse.ts +64 -0
  366. package/src/modules/inventory/db/costLayer.ts +54 -0
  367. package/src/modules/inventory/db/inventoryAdjustment.ts +88 -0
  368. package/src/modules/inventory/db/inventoryCount.ts +58 -0
  369. package/src/modules/inventory/db/inventoryCountLine.ts +61 -0
  370. package/src/modules/inventory/db/itemValuation.ts +50 -0
  371. package/src/modules/inventory/db/lot.ts +51 -0
  372. package/src/modules/inventory/db/lotStockLevel.ts +48 -0
  373. package/src/modules/inventory/db/serialNumber.ts +53 -0
  374. package/src/modules/inventory/db/stockLevel.ts +51 -0
  375. package/src/modules/inventory/db/stockMoveLine.ts +78 -0
  376. package/src/modules/inventory/db/stockMovement.ts +48 -0
  377. package/src/modules/inventory/db/storageLocation.ts +56 -0
  378. package/src/modules/inventory/db/valuationPolicy.ts +33 -0
  379. package/src/modules/inventory/db/warehouse.ts +45 -0
  380. package/src/modules/inventory/docs/commands/ApproveCountLine.md +44 -0
  381. package/src/modules/inventory/docs/commands/ApproveInventoryAdjustment.md +37 -0
  382. package/src/modules/inventory/docs/commands/AssignSerialNumber.md +46 -0
  383. package/src/modules/inventory/docs/commands/CancelInventoryCount.md +49 -0
  384. package/src/modules/inventory/docs/commands/CancelStockMovement.md +44 -0
  385. package/src/modules/inventory/docs/commands/CompleteInventoryCount.md +47 -0
  386. package/src/modules/inventory/docs/commands/ConfirmInventoryAdjustment.md +72 -0
  387. package/src/modules/inventory/docs/commands/ConfirmStockMovement.md +43 -0
  388. package/src/modules/inventory/docs/commands/CreateInventoryAdjustment.md +75 -0
  389. package/src/modules/inventory/docs/commands/CreateInventoryCount.md +49 -0
  390. package/src/modules/inventory/docs/commands/CreateLot.md +40 -0
  391. package/src/modules/inventory/docs/commands/CreateStockMovement.md +76 -0
  392. package/src/modules/inventory/docs/commands/CreateStorageLocation.md +66 -0
  393. package/src/modules/inventory/docs/commands/CreateValuationPolicy.md +45 -0
  394. package/src/modules/inventory/docs/commands/CreateWarehouse.md +47 -0
  395. package/src/modules/inventory/docs/commands/DeactivateStorageLocation.md +39 -0
  396. package/src/modules/inventory/docs/commands/DeactivateWarehouse.md +38 -0
  397. package/src/modules/inventory/docs/commands/ExecuteStockMovement.md +82 -0
  398. package/src/modules/inventory/docs/commands/ReactivateStorageLocation.md +42 -0
  399. package/src/modules/inventory/docs/commands/ReactivateWarehouse.md +42 -0
  400. package/src/modules/inventory/docs/commands/RecordCountLine.md +52 -0
  401. package/src/modules/inventory/docs/commands/RejectCountLine.md +42 -0
  402. package/src/modules/inventory/docs/commands/RejectInventoryAdjustment.md +38 -0
  403. package/src/modules/inventory/docs/commands/ReleaseReservation.md +37 -0
  404. package/src/modules/inventory/docs/commands/ReserveStock.md +49 -0
  405. package/src/modules/inventory/docs/commands/ReviseInventoryAdjustment.md +38 -0
  406. package/src/modules/inventory/docs/commands/StartInventoryCount.md +47 -0
  407. package/src/modules/inventory/docs/commands/SubmitInventoryAdjustment.md +37 -0
  408. package/src/modules/inventory/docs/commands/UpdateLot.md +41 -0
  409. package/src/modules/inventory/docs/commands/UpdateStockMovement.md +45 -0
  410. package/src/modules/inventory/docs/commands/UpdateStorageLocation.md +41 -0
  411. package/src/modules/inventory/docs/commands/UpdateValuationPolicy.md +44 -0
  412. package/src/modules/inventory/docs/commands/UpdateWarehouse.md +42 -0
  413. package/src/modules/inventory/docs/features/inventory-adjustment.md +64 -0
  414. package/src/modules/inventory/docs/features/inventory-count.md +78 -0
  415. package/src/modules/inventory/docs/features/inventory-valuation.md +77 -0
  416. package/src/modules/inventory/docs/features/lot-and-batch-tracking.md +81 -0
  417. package/src/modules/inventory/docs/features/scrap-management.md +63 -0
  418. package/src/modules/inventory/docs/features/serial-number-tracking.md +68 -0
  419. package/src/modules/inventory/docs/features/stock-movement.md +72 -0
  420. package/src/modules/inventory/docs/features/stock-tracking.md +78 -0
  421. package/src/modules/inventory/docs/features/warehouse-management.md +97 -0
  422. package/src/modules/inventory/docs/models/CostLayer.md +37 -0
  423. package/src/modules/inventory/docs/models/InventoryAdjustment.md +69 -0
  424. package/src/modules/inventory/docs/models/InventoryCount.md +53 -0
  425. package/src/modules/inventory/docs/models/InventoryCountLine.md +53 -0
  426. package/src/modules/inventory/docs/models/ItemValuation.md +38 -0
  427. package/src/modules/inventory/docs/models/Lot.md +45 -0
  428. package/src/modules/inventory/docs/models/LotStockLevel.md +34 -0
  429. package/src/modules/inventory/docs/models/SerialNumber.md +53 -0
  430. package/src/modules/inventory/docs/models/StockLevel.md +41 -0
  431. package/src/modules/inventory/docs/models/StockMoveLine.md +44 -0
  432. package/src/modules/inventory/docs/models/StockMovement.md +52 -0
  433. package/src/modules/inventory/docs/models/StorageLocation.md +55 -0
  434. package/src/modules/inventory/docs/models/ValuationPolicy.md +38 -0
  435. package/src/modules/inventory/docs/models/Warehouse.md +50 -0
  436. package/src/modules/inventory/docs/queries/GetInventoryAdjustment.md +40 -0
  437. package/src/modules/inventory/docs/queries/GetInventoryCount.md +43 -0
  438. package/src/modules/inventory/docs/queries/GetItemValuation.md +42 -0
  439. package/src/modules/inventory/docs/queries/GetLot.md +42 -0
  440. package/src/modules/inventory/docs/queries/GetSerialNumber.md +43 -0
  441. package/src/modules/inventory/docs/queries/GetSerialNumberHistory.md +50 -0
  442. package/src/modules/inventory/docs/queries/GetStockLevel.md +42 -0
  443. package/src/modules/inventory/docs/queries/GetStockMovement.md +41 -0
  444. package/src/modules/inventory/docs/queries/GetStorageLocation.md +40 -0
  445. package/src/modules/inventory/docs/queries/GetValuationPolicy.md +38 -0
  446. package/src/modules/inventory/docs/queries/GetWarehouse.md +40 -0
  447. package/src/modules/inventory/docs/queries/GetWarehouseStockSummary.md +50 -0
  448. package/src/modules/inventory/docs/queries/ListCostLayers.md +49 -0
  449. package/src/modules/inventory/docs/queries/ListExpiringLots.md +51 -0
  450. package/src/modules/inventory/docs/queries/ListInventoryAdjustments.md +47 -0
  451. package/src/modules/inventory/docs/queries/ListInventoryCounts.md +57 -0
  452. package/src/modules/inventory/docs/queries/ListItemValuations.md +44 -0
  453. package/src/modules/inventory/docs/queries/ListLots.md +57 -0
  454. package/src/modules/inventory/docs/queries/ListSerialNumbers.md +44 -0
  455. package/src/modules/inventory/docs/queries/ListStockLevels.md +49 -0
  456. package/src/modules/inventory/docs/queries/ListStockMovements.md +47 -0
  457. package/src/modules/inventory/docs/queries/ListStorageLocations.md +47 -0
  458. package/src/modules/inventory/docs/queries/ListValuationPolicies.md +38 -0
  459. package/src/modules/inventory/docs/queries/ListWarehouses.md +42 -0
  460. package/src/modules/inventory/docs/queries/TraceLotBackward.md +46 -0
  461. package/src/modules/inventory/docs/queries/TraceLotForward.md +46 -0
  462. package/src/modules/inventory/generated/.gitkeep +0 -0
  463. package/src/modules/inventory/generated/enums.ts +131 -0
  464. package/src/modules/inventory/generated/kysely-tailordb.ts +201 -0
  465. package/src/modules/inventory/index.ts +2 -0
  466. package/src/modules/inventory/lib/_db_deps.ts +17 -0
  467. package/src/modules/inventory/lib/errors.generated.ts +317 -0
  468. package/src/modules/inventory/lib/permissions.generated.ts +38 -0
  469. package/src/modules/inventory/lib/types.ts +92 -0
  470. package/src/modules/inventory/module.ts +202 -0
  471. package/src/modules/inventory/permissions.ts +3 -0
  472. package/src/modules/inventory/query/.gitkeep +0 -0
  473. package/src/modules/inventory/query/getInventoryAdjustment.generated.ts +5 -0
  474. package/src/modules/inventory/query/getInventoryAdjustment.test.ts +58 -0
  475. package/src/modules/inventory/query/getInventoryAdjustment.ts +16 -0
  476. package/src/modules/inventory/query/getInventoryCount.generated.ts +5 -0
  477. package/src/modules/inventory/query/getInventoryCount.test.ts +65 -0
  478. package/src/modules/inventory/query/getInventoryCount.ts +27 -0
  479. package/src/modules/inventory/query/getItemValuation.generated.ts +5 -0
  480. package/src/modules/inventory/query/getItemValuation.test.ts +72 -0
  481. package/src/modules/inventory/query/getItemValuation.ts +29 -0
  482. package/src/modules/inventory/query/getLot.generated.ts +5 -0
  483. package/src/modules/inventory/query/getLot.test.ts +62 -0
  484. package/src/modules/inventory/query/getLot.ts +28 -0
  485. package/src/modules/inventory/query/getSerialNumber.generated.ts +5 -0
  486. package/src/modules/inventory/query/getSerialNumber.test.ts +59 -0
  487. package/src/modules/inventory/query/getSerialNumber.ts +18 -0
  488. package/src/modules/inventory/query/getSerialNumberHistory.generated.ts +5 -0
  489. package/src/modules/inventory/query/getSerialNumberHistory.test.ts +80 -0
  490. package/src/modules/inventory/query/getSerialNumberHistory.ts +30 -0
  491. package/src/modules/inventory/query/getStockLevel.generated.ts +5 -0
  492. package/src/modules/inventory/query/getStockLevel.test.ts +70 -0
  493. package/src/modules/inventory/query/getStockLevel.ts +24 -0
  494. package/src/modules/inventory/query/getStockMovement.generated.ts +5 -0
  495. package/src/modules/inventory/query/getStockMovement.test.ts +62 -0
  496. package/src/modules/inventory/query/getStockMovement.ts +26 -0
  497. package/src/modules/inventory/query/getStorageLocation.generated.ts +5 -0
  498. package/src/modules/inventory/query/getStorageLocation.test.ts +54 -0
  499. package/src/modules/inventory/query/getStorageLocation.ts +26 -0
  500. package/src/modules/inventory/query/getValuationPolicy.generated.ts +5 -0
  501. package/src/modules/inventory/query/getValuationPolicy.test.ts +42 -0
  502. package/src/modules/inventory/query/getValuationPolicy.ts +16 -0
  503. package/src/modules/inventory/query/getWarehouse.generated.ts +5 -0
  504. package/src/modules/inventory/query/getWarehouse.test.ts +61 -0
  505. package/src/modules/inventory/query/getWarehouse.ts +26 -0
  506. package/src/modules/inventory/query/getWarehouseStockSummary.generated.ts +5 -0
  507. package/src/modules/inventory/query/getWarehouseStockSummary.test.ts +97 -0
  508. package/src/modules/inventory/query/getWarehouseStockSummary.ts +82 -0
  509. package/src/modules/inventory/query/listCostLayers.generated.ts +5 -0
  510. package/src/modules/inventory/query/listCostLayers.test.ts +58 -0
  511. package/src/modules/inventory/query/listCostLayers.ts +45 -0
  512. package/src/modules/inventory/query/listExpiringLots.generated.ts +5 -0
  513. package/src/modules/inventory/query/listExpiringLots.test.ts +70 -0
  514. package/src/modules/inventory/query/listExpiringLots.ts +74 -0
  515. package/src/modules/inventory/query/listInventoryAdjustments.generated.ts +5 -0
  516. package/src/modules/inventory/query/listInventoryAdjustments.test.ts +89 -0
  517. package/src/modules/inventory/query/listInventoryAdjustments.ts +59 -0
  518. package/src/modules/inventory/query/listInventoryCounts.generated.ts +5 -0
  519. package/src/modules/inventory/query/listInventoryCounts.test.ts +78 -0
  520. package/src/modules/inventory/query/listInventoryCounts.ts +55 -0
  521. package/src/modules/inventory/query/listItemValuations.generated.ts +5 -0
  522. package/src/modules/inventory/query/listItemValuations.test.ts +54 -0
  523. package/src/modules/inventory/query/listItemValuations.ts +39 -0
  524. package/src/modules/inventory/query/listLots.generated.ts +5 -0
  525. package/src/modules/inventory/query/listLots.test.ts +120 -0
  526. package/src/modules/inventory/query/listLots.ts +68 -0
  527. package/src/modules/inventory/query/listSerialNumbers.generated.ts +5 -0
  528. package/src/modules/inventory/query/listSerialNumbers.test.ts +58 -0
  529. package/src/modules/inventory/query/listSerialNumbers.ts +53 -0
  530. package/src/modules/inventory/query/listStockLevels.generated.ts +5 -0
  531. package/src/modules/inventory/query/listStockLevels.test.ts +73 -0
  532. package/src/modules/inventory/query/listStockLevels.ts +79 -0
  533. package/src/modules/inventory/query/listStockMovements.generated.ts +5 -0
  534. package/src/modules/inventory/query/listStockMovements.test.ts +98 -0
  535. package/src/modules/inventory/query/listStockMovements.ts +105 -0
  536. package/src/modules/inventory/query/listStorageLocations.generated.ts +5 -0
  537. package/src/modules/inventory/query/listStorageLocations.test.ts +70 -0
  538. package/src/modules/inventory/query/listStorageLocations.ts +53 -0
  539. package/src/modules/inventory/query/listValuationPolicies.generated.ts +5 -0
  540. package/src/modules/inventory/query/listValuationPolicies.test.ts +38 -0
  541. package/src/modules/inventory/query/listValuationPolicies.ts +39 -0
  542. package/src/modules/inventory/query/listWarehouses.generated.ts +5 -0
  543. package/src/modules/inventory/query/listWarehouses.test.ts +60 -0
  544. package/src/modules/inventory/query/listWarehouses.ts +39 -0
  545. package/src/modules/inventory/query/traceLotBackward.generated.ts +5 -0
  546. package/src/modules/inventory/query/traceLotBackward.test.ts +63 -0
  547. package/src/modules/inventory/query/traceLotBackward.ts +36 -0
  548. package/src/modules/inventory/query/traceLotForward.generated.ts +5 -0
  549. package/src/modules/inventory/query/traceLotForward.test.ts +63 -0
  550. package/src/modules/inventory/query/traceLotForward.ts +36 -0
  551. package/src/modules/inventory/tailor.config.ts +13 -0
  552. package/src/modules/inventory/tailor.d.ts +13 -0
  553. package/src/modules/inventory/testing/commandTestUtils.ts +29 -0
  554. package/src/modules/inventory/testing/fixtures.ts +412 -0
  555. package/src/modules/item-management/command/activateItem.generated.ts +1 -1
  556. package/src/modules/item-management/command/activateItem.ts +1 -1
  557. package/src/modules/item-management/command/assignItemToTaxonomy.generated.ts +1 -1
  558. package/src/modules/item-management/command/assignItemToTaxonomy.ts +1 -1
  559. package/src/modules/item-management/command/createItem.generated.ts +1 -1
  560. package/src/modules/item-management/command/createItem.test.ts +1 -1
  561. package/src/modules/item-management/command/createItem.ts +1 -1
  562. package/src/modules/item-management/command/createTaxonomyNode.generated.ts +1 -1
  563. package/src/modules/item-management/command/createTaxonomyNode.test.ts +1 -1
  564. package/src/modules/item-management/command/createTaxonomyNode.ts +1 -1
  565. package/src/modules/item-management/command/deactivateItem.generated.ts +1 -1
  566. package/src/modules/item-management/command/deactivateItem.ts +1 -1
  567. package/src/modules/item-management/command/deleteItem.generated.ts +1 -1
  568. package/src/modules/item-management/command/deleteItem.ts +1 -1
  569. package/src/modules/item-management/command/deleteTaxonomyNode.generated.ts +1 -1
  570. package/src/modules/item-management/command/deleteTaxonomyNode.ts +1 -1
  571. package/src/modules/item-management/command/moveTaxonomyNode.generated.ts +1 -1
  572. package/src/modules/item-management/command/moveTaxonomyNode.test.ts +1 -1
  573. package/src/modules/item-management/command/moveTaxonomyNode.ts +1 -1
  574. package/src/modules/item-management/command/reactivateItem.generated.ts +1 -1
  575. package/src/modules/item-management/command/reactivateItem.ts +1 -1
  576. package/src/modules/item-management/command/removeItemFromTaxonomy.generated.ts +1 -1
  577. package/src/modules/item-management/command/removeItemFromTaxonomy.ts +1 -1
  578. package/src/modules/item-management/command/updateItem.generated.ts +1 -1
  579. package/src/modules/item-management/command/updateItem.test.ts +1 -1
  580. package/src/modules/item-management/command/updateItem.ts +1 -1
  581. package/src/modules/item-management/command/updateTaxonomyNode.generated.ts +1 -1
  582. package/src/modules/item-management/command/updateTaxonomyNode.ts +1 -1
  583. package/src/modules/item-management/docs/models/{item.md → Item.md} +1 -1
  584. package/src/modules/item-management/lib/errors.generated.ts +1 -1
  585. package/src/modules/item-management/lib/permissions.generated.ts +1 -1
  586. package/src/modules/item-management/lib/types.ts +6 -1
  587. package/src/modules/item-management/module.ts +1 -1
  588. package/src/modules/item-management/query/calculateNodeDepth.generated.ts +1 -1
  589. package/src/modules/item-management/query/calculateNodeDepth.ts +1 -1
  590. package/src/modules/item-management/query/calculateSubtreeDepth.generated.ts +1 -1
  591. package/src/modules/item-management/query/calculateSubtreeDepth.ts +1 -1
  592. package/src/modules/item-management/query/detectCircularReference.generated.ts +1 -1
  593. package/src/modules/item-management/query/detectCircularReference.ts +1 -1
  594. package/src/modules/item-management/query/getItem.generated.ts +1 -1
  595. package/src/modules/item-management/query/getItem.ts +1 -1
  596. package/src/modules/item-management/query/getItemTaxonomyAssignment.generated.ts +1 -1
  597. package/src/modules/item-management/query/getItemTaxonomyAssignment.ts +1 -1
  598. package/src/modules/item-management/query/getTaxonomyNode.generated.ts +1 -1
  599. package/src/modules/item-management/query/getTaxonomyNode.ts +1 -1
  600. package/src/modules/item-management/query/getTaxonomyNodeAssignments.generated.ts +1 -1
  601. package/src/modules/item-management/query/getTaxonomyNodeAssignments.ts +1 -1
  602. package/src/modules/item-management/query/getTaxonomyNodeChildren.generated.ts +1 -1
  603. package/src/modules/item-management/query/getTaxonomyNodeChildren.ts +1 -1
  604. package/src/modules/organization/command/activateCompany.generated.ts +1 -1
  605. package/src/modules/organization/command/activateCompany.test.ts +1 -1
  606. package/src/modules/organization/command/activateCompany.ts +1 -1
  607. package/src/modules/organization/command/createCompany.generated.ts +1 -1
  608. package/src/modules/organization/command/createCompany.test.ts +1 -1
  609. package/src/modules/organization/command/createCompany.ts +1 -1
  610. package/src/modules/organization/command/createDepartment.generated.ts +1 -1
  611. package/src/modules/organization/command/createDepartment.ts +1 -1
  612. package/src/modules/organization/command/createSite.generated.ts +1 -1
  613. package/src/modules/organization/command/createSite.ts +1 -1
  614. package/src/modules/organization/command/deactivateCompany.generated.ts +1 -1
  615. package/src/modules/organization/command/deactivateCompany.ts +1 -1
  616. package/src/modules/organization/command/deactivateDepartment.generated.ts +1 -1
  617. package/src/modules/organization/command/deactivateDepartment.ts +1 -1
  618. package/src/modules/organization/command/deactivateSite.generated.ts +1 -1
  619. package/src/modules/organization/command/deactivateSite.ts +1 -1
  620. package/src/modules/organization/command/deleteCompany.generated.ts +1 -1
  621. package/src/modules/organization/command/deleteCompany.ts +1 -1
  622. package/src/modules/organization/command/reactivateCompany.generated.ts +1 -1
  623. package/src/modules/organization/command/reactivateCompany.ts +1 -1
  624. package/src/modules/organization/command/reactivateDepartment.generated.ts +1 -1
  625. package/src/modules/organization/command/reactivateDepartment.ts +1 -1
  626. package/src/modules/organization/command/reactivateSite.generated.ts +1 -1
  627. package/src/modules/organization/command/reactivateSite.ts +1 -1
  628. package/src/modules/organization/command/updateCompany.generated.ts +1 -1
  629. package/src/modules/organization/command/updateCompany.test.ts +1 -1
  630. package/src/modules/organization/command/updateCompany.ts +1 -1
  631. package/src/modules/organization/command/updateDepartment.generated.ts +1 -1
  632. package/src/modules/organization/command/updateDepartment.ts +1 -1
  633. package/src/modules/organization/command/updateSite.generated.ts +1 -1
  634. package/src/modules/organization/command/updateSite.ts +1 -1
  635. package/src/modules/organization/lib/errors.generated.ts +1 -1
  636. package/src/modules/organization/lib/permissions.generated.ts +1 -1
  637. package/src/modules/organization/lib/types.ts +6 -1
  638. package/src/modules/organization/module.ts +1 -1
  639. package/src/modules/organization/permissions.ts +1 -1
  640. package/src/modules/organization/query/detectDepartmentCircularReference.generated.ts +1 -1
  641. package/src/modules/organization/query/detectDepartmentCircularReference.ts +1 -1
  642. package/src/modules/organization/query/getCompany.generated.ts +1 -1
  643. package/src/modules/organization/query/getCompany.ts +1 -1
  644. package/src/modules/organization/query/getDepartment.generated.ts +1 -1
  645. package/src/modules/organization/query/getDepartment.ts +1 -1
  646. package/src/modules/organization/query/getDepartmentChildren.generated.ts +1 -1
  647. package/src/modules/organization/query/getDepartmentChildren.ts +1 -1
  648. package/src/modules/organization/query/getSite.generated.ts +1 -1
  649. package/src/modules/organization/query/getSite.ts +1 -1
  650. package/src/modules/organization/query/listDepartmentsByCompany.generated.ts +1 -1
  651. package/src/modules/organization/query/listDepartmentsByCompany.ts +2 -2
  652. package/src/modules/organization/query/listSitesByCompany.generated.ts +1 -1
  653. package/src/modules/organization/query/listSitesByCompany.ts +2 -2
  654. package/src/modules/primitives/command/activateCategory.generated.ts +1 -1
  655. package/src/modules/primitives/command/activateCategory.ts +1 -1
  656. package/src/modules/primitives/command/activateCurrency.generated.ts +1 -1
  657. package/src/modules/primitives/command/activateCurrency.ts +1 -1
  658. package/src/modules/primitives/command/activateUnit.generated.ts +1 -1
  659. package/src/modules/primitives/command/activateUnit.ts +1 -1
  660. package/src/modules/primitives/command/createCategory.generated.ts +1 -1
  661. package/src/modules/primitives/command/createCategory.ts +1 -1
  662. package/src/modules/primitives/command/createCurrency.generated.ts +1 -1
  663. package/src/modules/primitives/command/createCurrency.ts +1 -1
  664. package/src/modules/primitives/command/createExchangeRate.generated.ts +1 -1
  665. package/src/modules/primitives/command/createExchangeRate.ts +1 -1
  666. package/src/modules/primitives/command/createUnit.generated.ts +1 -1
  667. package/src/modules/primitives/command/createUnit.ts +1 -1
  668. package/src/modules/primitives/command/deactivateCategory.generated.ts +1 -1
  669. package/src/modules/primitives/command/deactivateCategory.ts +1 -1
  670. package/src/modules/primitives/command/deactivateCurrency.generated.ts +1 -1
  671. package/src/modules/primitives/command/deactivateCurrency.ts +1 -1
  672. package/src/modules/primitives/command/deactivateUnit.generated.ts +1 -1
  673. package/src/modules/primitives/command/deactivateUnit.ts +1 -1
  674. package/src/modules/primitives/command/setBaseCurrency.generated.ts +1 -1
  675. package/src/modules/primitives/command/setBaseCurrency.ts +1 -1
  676. package/src/modules/primitives/command/setReferenceUnit.generated.ts +1 -1
  677. package/src/modules/primitives/command/setReferenceUnit.ts +1 -1
  678. package/src/modules/primitives/lib/errors.generated.ts +1 -1
  679. package/src/modules/primitives/lib/permissions.generated.ts +1 -1
  680. package/src/modules/primitives/lib/types.ts +6 -1
  681. package/src/modules/primitives/module.ts +1 -1
  682. package/src/modules/primitives/query/convertAmount.generated.ts +1 -1
  683. package/src/modules/primitives/query/convertAmount.test.ts +1 -1
  684. package/src/modules/primitives/query/convertAmount.ts +1 -1
  685. package/src/modules/primitives/query/convertQuantity.generated.ts +1 -1
  686. package/src/modules/primitives/query/convertQuantity.test.ts +1 -1
  687. package/src/modules/primitives/query/convertQuantity.ts +1 -1
  688. package/src/modules/primitives/query/getBaseCurrency.generated.ts +1 -1
  689. package/src/modules/primitives/query/getBaseCurrency.test.ts +1 -1
  690. package/src/modules/primitives/query/getBaseCurrency.ts +1 -1
  691. package/src/modules/primitives/query/getCurrency.generated.ts +1 -1
  692. package/src/modules/primitives/query/getCurrency.ts +1 -1
  693. package/src/modules/primitives/query/getUnit.generated.ts +1 -1
  694. package/src/modules/primitives/query/getUnit.ts +1 -1
  695. package/src/modules/primitives/query/getUoMCategory.generated.ts +1 -1
  696. package/src/modules/primitives/query/getUoMCategory.ts +1 -1
  697. package/src/modules/primitives/query/listUnitsByCategory.generated.ts +1 -1
  698. package/src/modules/primitives/query/listUnitsByCategory.ts +2 -2
  699. package/src/modules/primitives/seed/currencies.ts +22 -0
  700. package/src/modules/primitives/seed/exchangeRates.ts +22 -0
  701. package/src/modules/primitives/seed/index.ts +4 -0
  702. package/src/modules/primitives/seed/seed.test.ts +80 -0
  703. package/src/modules/primitives/seed/units.ts +62 -0
  704. package/src/modules/primitives/seed/uomCategories.ts +24 -0
  705. package/src/modules/product-management/command/activateProduct.generated.ts +1 -1
  706. package/src/modules/product-management/command/activateProduct.ts +1 -1
  707. package/src/modules/product-management/command/assignProductToCategory.generated.ts +1 -1
  708. package/src/modules/product-management/command/assignProductToCategory.ts +1 -1
  709. package/src/modules/product-management/command/createProduct.generated.ts +1 -1
  710. package/src/modules/product-management/command/createProduct.test.ts +1 -1
  711. package/src/modules/product-management/command/createProduct.ts +1 -1
  712. package/src/modules/product-management/command/createProductAttribute.generated.ts +1 -1
  713. package/src/modules/product-management/command/createProductAttribute.ts +1 -1
  714. package/src/modules/product-management/command/createProductAttributeValue.generated.ts +1 -1
  715. package/src/modules/product-management/command/createProductAttributeValue.ts +1 -1
  716. package/src/modules/product-management/command/createProductCategory.generated.ts +1 -1
  717. package/src/modules/product-management/command/createProductCategory.test.ts +1 -1
  718. package/src/modules/product-management/command/createProductCategory.ts +1 -1
  719. package/src/modules/product-management/command/deactivateProduct.generated.ts +1 -1
  720. package/src/modules/product-management/command/deactivateProduct.ts +1 -1
  721. package/src/modules/product-management/command/deleteProduct.generated.ts +1 -1
  722. package/src/modules/product-management/command/deleteProduct.ts +1 -1
  723. package/src/modules/product-management/command/deleteProductAttribute.generated.ts +1 -1
  724. package/src/modules/product-management/command/deleteProductAttribute.ts +1 -1
  725. package/src/modules/product-management/command/deleteProductAttributeValue.generated.ts +1 -1
  726. package/src/modules/product-management/command/deleteProductAttributeValue.ts +1 -1
  727. package/src/modules/product-management/command/deleteProductCategory.generated.ts +1 -1
  728. package/src/modules/product-management/command/deleteProductCategory.ts +1 -1
  729. package/src/modules/product-management/command/generateVariants.generated.ts +1 -1
  730. package/src/modules/product-management/command/generateVariants.test.ts +1 -1
  731. package/src/modules/product-management/command/generateVariants.ts +1 -1
  732. package/src/modules/product-management/command/moveProductCategory.generated.ts +1 -1
  733. package/src/modules/product-management/command/moveProductCategory.test.ts +1 -1
  734. package/src/modules/product-management/command/moveProductCategory.ts +1 -1
  735. package/src/modules/product-management/command/reactivateProduct.generated.ts +1 -1
  736. package/src/modules/product-management/command/reactivateProduct.ts +1 -1
  737. package/src/modules/product-management/command/removeProductFromCategory.generated.ts +1 -1
  738. package/src/modules/product-management/command/removeProductFromCategory.ts +1 -1
  739. package/src/modules/product-management/command/setProductAttributeAssignment.generated.ts +1 -1
  740. package/src/modules/product-management/command/setProductAttributeAssignment.ts +1 -1
  741. package/src/modules/product-management/command/updateProduct.generated.ts +1 -1
  742. package/src/modules/product-management/command/updateProduct.test.ts +1 -1
  743. package/src/modules/product-management/command/updateProduct.ts +1 -1
  744. package/src/modules/product-management/command/updateProductAttribute.generated.ts +1 -1
  745. package/src/modules/product-management/command/updateProductAttribute.ts +1 -1
  746. package/src/modules/product-management/command/updateProductAttributeValue.generated.ts +1 -1
  747. package/src/modules/product-management/command/updateProductAttributeValue.ts +1 -1
  748. package/src/modules/product-management/command/updateProductCategory.generated.ts +1 -1
  749. package/src/modules/product-management/command/updateProductCategory.ts +1 -1
  750. package/src/modules/product-management/lib/errors.generated.ts +1 -1
  751. package/src/modules/product-management/lib/permissions.generated.ts +1 -1
  752. package/src/modules/product-management/lib/types.ts +6 -1
  753. package/src/modules/product-management/module.ts +1 -1
  754. package/src/modules/product-management/query/calculateCategoryDepth.generated.ts +1 -1
  755. package/src/modules/product-management/query/calculateCategoryDepth.ts +1 -1
  756. package/src/modules/product-management/query/detectCategoryCircularReference.generated.ts +1 -1
  757. package/src/modules/product-management/query/detectCategoryCircularReference.ts +1 -1
  758. package/src/modules/product-management/query/getProduct.generated.ts +1 -1
  759. package/src/modules/product-management/query/getProduct.ts +1 -1
  760. package/src/modules/product-management/query/getProductAttribute.generated.ts +1 -1
  761. package/src/modules/product-management/query/getProductAttribute.ts +1 -1
  762. package/src/modules/product-management/query/getProductAttributeAssignment.generated.ts +1 -1
  763. package/src/modules/product-management/query/getProductAttributeAssignment.ts +1 -1
  764. package/src/modules/product-management/query/getProductAttributeValue.generated.ts +1 -1
  765. package/src/modules/product-management/query/getProductAttributeValue.ts +1 -1
  766. package/src/modules/product-management/query/getProductCategory.generated.ts +1 -1
  767. package/src/modules/product-management/query/getProductCategory.ts +1 -1
  768. package/src/modules/product-management/query/getProductCategoryAssignment.generated.ts +1 -1
  769. package/src/modules/product-management/query/getProductCategoryAssignment.ts +1 -1
  770. package/src/modules/product-management/query/getProductVariant.generated.ts +1 -1
  771. package/src/modules/product-management/query/getProductVariant.ts +1 -1
  772. package/src/modules/product-management/query/listAttributeAssignmentsByAttribute.generated.ts +1 -1
  773. package/src/modules/product-management/query/listAttributeAssignmentsByAttribute.ts +1 -1
  774. package/src/modules/product-management/query/listCategoryAssignmentsByProduct.generated.ts +1 -1
  775. package/src/modules/product-management/query/listCategoryAssignmentsByProduct.ts +1 -1
  776. package/src/modules/product-management/query/listProductAttributeAssignments.generated.ts +1 -1
  777. package/src/modules/product-management/query/listProductAttributeAssignments.ts +1 -1
  778. package/src/modules/product-management/query/listProductAttributeValues.generated.ts +1 -1
  779. package/src/modules/product-management/query/listProductAttributeValues.ts +1 -1
  780. package/src/modules/product-management/query/listProductCategoryAssignments.generated.ts +1 -1
  781. package/src/modules/product-management/query/listProductCategoryAssignments.ts +1 -1
  782. package/src/modules/product-management/query/listProductCategoryChildren.generated.ts +1 -1
  783. package/src/modules/product-management/query/listProductCategoryChildren.ts +1 -1
  784. package/src/modules/product-management/query/listProductVariants.generated.ts +1 -1
  785. package/src/modules/product-management/query/listProductVariants.ts +1 -1
  786. package/src/modules/purchase/README.md +63 -0
  787. package/src/modules/purchase/command/.gitkeep +0 -0
  788. package/src/modules/purchase/command/activatePurchasePaymentTerm.generated.ts +6 -0
  789. package/src/modules/purchase/command/activatePurchasePaymentTerm.test.ts +53 -0
  790. package/src/modules/purchase/command/activatePurchasePaymentTerm.ts +39 -0
  791. package/src/modules/purchase/command/activatePurchasePriceList.generated.ts +6 -0
  792. package/src/modules/purchase/command/activatePurchasePriceList.test.ts +39 -0
  793. package/src/modules/purchase/command/activatePurchasePriceList.ts +32 -0
  794. package/src/modules/purchase/command/activatePurchasePriceRule.generated.ts +6 -0
  795. package/src/modules/purchase/command/activatePurchasePriceRule.test.ts +133 -0
  796. package/src/modules/purchase/command/activatePurchasePriceRule.ts +75 -0
  797. package/src/modules/purchase/command/approvePurchaseOrder.generated.ts +6 -0
  798. package/src/modules/purchase/command/approvePurchaseOrder.test.ts +161 -0
  799. package/src/modules/purchase/command/approvePurchaseOrder.ts +89 -0
  800. package/src/modules/purchase/command/cancelGoodsReceipt.generated.ts +6 -0
  801. package/src/modules/purchase/command/cancelGoodsReceipt.test.ts +37 -0
  802. package/src/modules/purchase/command/cancelGoodsReceipt.ts +29 -0
  803. package/src/modules/purchase/command/cancelPurchaseBill.generated.ts +6 -0
  804. package/src/modules/purchase/command/cancelPurchaseBill.test.ts +101 -0
  805. package/src/modules/purchase/command/cancelPurchaseBill.ts +84 -0
  806. package/src/modules/purchase/command/cancelPurchaseOrder.generated.ts +6 -0
  807. package/src/modules/purchase/command/cancelPurchaseOrder.test.ts +119 -0
  808. package/src/modules/purchase/command/cancelPurchaseOrder.ts +65 -0
  809. package/src/modules/purchase/command/closePurchaseOrder.generated.ts +6 -0
  810. package/src/modules/purchase/command/closePurchaseOrder.test.ts +128 -0
  811. package/src/modules/purchase/command/closePurchaseOrder.ts +58 -0
  812. package/src/modules/purchase/command/createGoodsReceipt.generated.ts +6 -0
  813. package/src/modules/purchase/command/createGoodsReceipt.test.ts +233 -0
  814. package/src/modules/purchase/command/createGoodsReceipt.ts +93 -0
  815. package/src/modules/purchase/command/createPurchaseBill.generated.ts +6 -0
  816. package/src/modules/purchase/command/createPurchaseBill.test.ts +277 -0
  817. package/src/modules/purchase/command/createPurchaseBill.ts +107 -0
  818. package/src/modules/purchase/command/createPurchaseOrder.generated.ts +6 -0
  819. package/src/modules/purchase/command/createPurchaseOrder.test.ts +291 -0
  820. package/src/modules/purchase/command/createPurchaseOrder.ts +131 -0
  821. package/src/modules/purchase/command/createPurchasePaymentTerm.generated.ts +6 -0
  822. package/src/modules/purchase/command/createPurchasePaymentTerm.test.ts +140 -0
  823. package/src/modules/purchase/command/createPurchasePaymentTerm.ts +66 -0
  824. package/src/modules/purchase/command/createPurchasePriceList.generated.ts +6 -0
  825. package/src/modules/purchase/command/createPurchasePriceList.test.ts +108 -0
  826. package/src/modules/purchase/command/createPurchasePriceList.ts +63 -0
  827. package/src/modules/purchase/command/createPurchasePriceRule.generated.ts +6 -0
  828. package/src/modules/purchase/command/createPurchasePriceRule.test.ts +139 -0
  829. package/src/modules/purchase/command/createPurchasePriceRule.ts +95 -0
  830. package/src/modules/purchase/command/deactivatePurchasePaymentTerm.generated.ts +6 -0
  831. package/src/modules/purchase/command/deactivatePurchasePaymentTerm.test.ts +49 -0
  832. package/src/modules/purchase/command/deactivatePurchasePaymentTerm.ts +41 -0
  833. package/src/modules/purchase/command/deactivatePurchasePriceList.generated.ts +6 -0
  834. package/src/modules/purchase/command/deactivatePurchasePriceList.test.ts +50 -0
  835. package/src/modules/purchase/command/deactivatePurchasePriceList.ts +32 -0
  836. package/src/modules/purchase/command/deactivatePurchasePriceRule.generated.ts +6 -0
  837. package/src/modules/purchase/command/deactivatePurchasePriceRule.test.ts +50 -0
  838. package/src/modules/purchase/command/deactivatePurchasePriceRule.ts +32 -0
  839. package/src/modules/purchase/command/matchPurchaseBill.generated.ts +6 -0
  840. package/src/modules/purchase/command/matchPurchaseBill.test.ts +188 -0
  841. package/src/modules/purchase/command/matchPurchaseBill.ts +146 -0
  842. package/src/modules/purchase/command/postGoodsReceipt.generated.ts +6 -0
  843. package/src/modules/purchase/command/postGoodsReceipt.test.ts +210 -0
  844. package/src/modules/purchase/command/postGoodsReceipt.ts +143 -0
  845. package/src/modules/purchase/command/rejectPurchaseOrder.generated.ts +6 -0
  846. package/src/modules/purchase/command/rejectPurchaseOrder.test.ts +79 -0
  847. package/src/modules/purchase/command/rejectPurchaseOrder.ts +41 -0
  848. package/src/modules/purchase/command/releasePurchaseBill.generated.ts +6 -0
  849. package/src/modules/purchase/command/releasePurchaseBill.test.ts +94 -0
  850. package/src/modules/purchase/command/releasePurchaseBill.ts +111 -0
  851. package/src/modules/purchase/command/setSupplierDefaultPurchasePaymentTerm.generated.ts +6 -0
  852. package/src/modules/purchase/command/setSupplierDefaultPurchasePaymentTerm.test.ts +171 -0
  853. package/src/modules/purchase/command/setSupplierDefaultPurchasePaymentTerm.ts +90 -0
  854. package/src/modules/purchase/command/submitPurchaseOrder.generated.ts +6 -0
  855. package/src/modules/purchase/command/submitPurchaseOrder.test.ts +98 -0
  856. package/src/modules/purchase/command/submitPurchaseOrder.ts +73 -0
  857. package/src/modules/purchase/command/updateGoodsReceipt.generated.ts +6 -0
  858. package/src/modules/purchase/command/updateGoodsReceipt.test.ts +115 -0
  859. package/src/modules/purchase/command/updateGoodsReceipt.ts +73 -0
  860. package/src/modules/purchase/command/updatePurchaseBill.generated.ts +6 -0
  861. package/src/modules/purchase/command/updatePurchaseBill.test.ts +137 -0
  862. package/src/modules/purchase/command/updatePurchaseBill.ts +89 -0
  863. package/src/modules/purchase/command/updatePurchaseOrder.generated.ts +6 -0
  864. package/src/modules/purchase/command/updatePurchaseOrder.test.ts +195 -0
  865. package/src/modules/purchase/command/updatePurchaseOrder.ts +121 -0
  866. package/src/modules/purchase/command/updatePurchasePaymentTerm.generated.ts +6 -0
  867. package/src/modules/purchase/command/updatePurchasePaymentTerm.test.ts +154 -0
  868. package/src/modules/purchase/command/updatePurchasePaymentTerm.ts +73 -0
  869. package/src/modules/purchase/command/updatePurchasePriceList.generated.ts +6 -0
  870. package/src/modules/purchase/command/updatePurchasePriceList.test.ts +73 -0
  871. package/src/modules/purchase/command/updatePurchasePriceList.ts +55 -0
  872. package/src/modules/purchase/command/updatePurchasePriceRule.generated.ts +6 -0
  873. package/src/modules/purchase/command/updatePurchasePriceRule.test.ts +191 -0
  874. package/src/modules/purchase/command/updatePurchasePriceRule.ts +104 -0
  875. package/src/modules/purchase/db/.gitkeep +0 -0
  876. package/src/modules/purchase/db/goodsReceipt.ts +62 -0
  877. package/src/modules/purchase/db/purchaseBill.ts +74 -0
  878. package/src/modules/purchase/db/purchaseOrder.ts +100 -0
  879. package/src/modules/purchase/db/purchasePaymentTerm.ts +46 -0
  880. package/src/modules/purchase/db/purchasePriceList.ts +53 -0
  881. package/src/modules/purchase/db/purchasePriceRule.ts +74 -0
  882. package/src/modules/purchase/db/supplierProfile.ts +59 -0
  883. package/src/modules/purchase/docs/commands/ActivatePurchasePaymentTerm.md +39 -0
  884. package/src/modules/purchase/docs/commands/ActivatePurchasePriceList.md +37 -0
  885. package/src/modules/purchase/docs/commands/ActivatePurchasePriceRule.md +47 -0
  886. package/src/modules/purchase/docs/commands/ApprovePurchaseOrder.md +55 -0
  887. package/src/modules/purchase/docs/commands/CancelGoodsReceipt.md +39 -0
  888. package/src/modules/purchase/docs/commands/CancelPurchaseBill.md +49 -0
  889. package/src/modules/purchase/docs/commands/CancelPurchaseOrder.md +47 -0
  890. package/src/modules/purchase/docs/commands/ClosePurchaseOrder.md +49 -0
  891. package/src/modules/purchase/docs/commands/CreateGoodsReceipt.md +54 -0
  892. package/src/modules/purchase/docs/commands/CreatePurchaseBill.md +59 -0
  893. package/src/modules/purchase/docs/commands/CreatePurchaseOrder.md +66 -0
  894. package/src/modules/purchase/docs/commands/CreatePurchasePaymentTerm.md +52 -0
  895. package/src/modules/purchase/docs/commands/CreatePurchasePriceList.md +48 -0
  896. package/src/modules/purchase/docs/commands/CreatePurchasePriceRule.md +62 -0
  897. package/src/modules/purchase/docs/commands/DeactivatePurchasePaymentTerm.md +42 -0
  898. package/src/modules/purchase/docs/commands/DeactivatePurchasePriceList.md +39 -0
  899. package/src/modules/purchase/docs/commands/DeactivatePurchasePriceRule.md +39 -0
  900. package/src/modules/purchase/docs/commands/MatchPurchaseBill.md +63 -0
  901. package/src/modules/purchase/docs/commands/PostGoodsReceipt.md +61 -0
  902. package/src/modules/purchase/docs/commands/RejectPurchaseOrder.md +44 -0
  903. package/src/modules/purchase/docs/commands/ReleasePurchaseBill.md +48 -0
  904. package/src/modules/purchase/docs/commands/SetSupplierDefaultPurchasePaymentTerm.md +50 -0
  905. package/src/modules/purchase/docs/commands/SubmitPurchaseOrder.md +51 -0
  906. package/src/modules/purchase/docs/commands/UpdateGoodsReceipt.md +48 -0
  907. package/src/modules/purchase/docs/commands/UpdatePurchaseBill.md +51 -0
  908. package/src/modules/purchase/docs/commands/UpdatePurchaseOrder.md +59 -0
  909. package/src/modules/purchase/docs/commands/UpdatePurchasePaymentTerm.md +51 -0
  910. package/src/modules/purchase/docs/commands/UpdatePurchasePriceList.md +43 -0
  911. package/src/modules/purchase/docs/commands/UpdatePurchasePriceRule.md +60 -0
  912. package/src/modules/purchase/docs/features/goods-receipt-matching.md +71 -0
  913. package/src/modules/purchase/docs/features/purchase-order-lifecycle.md +87 -0
  914. package/src/modules/purchase/docs/features/purchase-payment-terms.md +67 -0
  915. package/src/modules/purchase/docs/features/supplier-bill-matching.md +79 -0
  916. package/src/modules/purchase/docs/features/supplier-purchase-pricing.md +72 -0
  917. package/src/modules/purchase/docs/models/GoodsReceipt.md +58 -0
  918. package/src/modules/purchase/docs/models/PurchaseBill.md +68 -0
  919. package/src/modules/purchase/docs/models/PurchaseOrder.md +88 -0
  920. package/src/modules/purchase/docs/models/PurchasePaymentTerm.md +59 -0
  921. package/src/modules/purchase/docs/models/PurchasePriceList.md +53 -0
  922. package/src/modules/purchase/docs/models/PurchasePriceRule.md +58 -0
  923. package/src/modules/purchase/docs/models/SupplierProfile.md +37 -0
  924. package/src/modules/purchase/docs/queries/CalculatePurchaseBillDueSchedule.md +47 -0
  925. package/src/modules/purchase/docs/queries/CalculatePurchasePrice.md +53 -0
  926. package/src/modules/purchase/docs/queries/GetGoodsReceipt.md +36 -0
  927. package/src/modules/purchase/docs/queries/GetPurchaseBill.md +41 -0
  928. package/src/modules/purchase/docs/queries/GetPurchaseOrder.md +42 -0
  929. package/src/modules/purchase/docs/queries/GetPurchasePaymentTerm.md +36 -0
  930. package/src/modules/purchase/docs/queries/GetPurchasePriceList.md +36 -0
  931. package/src/modules/purchase/docs/queries/GetSupplierProfile.md +36 -0
  932. package/src/modules/purchase/executor/.gitkeep +0 -0
  933. package/src/modules/purchase/generated/.gitkeep +0 -0
  934. package/src/modules/purchase/generated/enums.ts +63 -0
  935. package/src/modules/purchase/generated/kysely-tailordb.ts +186 -0
  936. package/src/modules/purchase/index.ts +2 -0
  937. package/src/modules/purchase/lib/_db_deps.ts +77 -0
  938. package/src/modules/purchase/lib/domain.ts +467 -0
  939. package/src/modules/purchase/lib/errors.generated.ts +367 -0
  940. package/src/modules/purchase/lib/permissions.generated.ts +34 -0
  941. package/src/modules/purchase/lib/types.ts +65 -0
  942. package/src/modules/purchase/module.ts +218 -0
  943. package/src/modules/purchase/permissions.ts +1 -0
  944. package/src/modules/purchase/query/.gitkeep +0 -0
  945. package/src/modules/purchase/query/calculatePurchaseBillDueSchedule.generated.ts +5 -0
  946. package/src/modules/purchase/query/calculatePurchaseBillDueSchedule.test.ts +183 -0
  947. package/src/modules/purchase/query/calculatePurchaseBillDueSchedule.ts +41 -0
  948. package/src/modules/purchase/query/calculatePurchasePrice.generated.ts +5 -0
  949. package/src/modules/purchase/query/calculatePurchasePrice.test.ts +143 -0
  950. package/src/modules/purchase/query/calculatePurchasePrice.ts +113 -0
  951. package/src/modules/purchase/query/getGoodsReceipt.generated.ts +5 -0
  952. package/src/modules/purchase/query/getGoodsReceipt.test.ts +42 -0
  953. package/src/modules/purchase/query/getGoodsReceipt.ts +27 -0
  954. package/src/modules/purchase/query/getPurchaseBill.generated.ts +5 -0
  955. package/src/modules/purchase/query/getPurchaseBill.test.ts +69 -0
  956. package/src/modules/purchase/query/getPurchaseBill.ts +35 -0
  957. package/src/modules/purchase/query/getPurchaseOrder.generated.ts +5 -0
  958. package/src/modules/purchase/query/getPurchaseOrder.test.ts +65 -0
  959. package/src/modules/purchase/query/getPurchaseOrder.ts +33 -0
  960. package/src/modules/purchase/query/getPurchasePaymentTerm.generated.ts +5 -0
  961. package/src/modules/purchase/query/getPurchasePaymentTerm.test.ts +44 -0
  962. package/src/modules/purchase/query/getPurchasePaymentTerm.ts +30 -0
  963. package/src/modules/purchase/query/getPurchasePriceList.generated.ts +5 -0
  964. package/src/modules/purchase/query/getPurchasePriceList.test.ts +48 -0
  965. package/src/modules/purchase/query/getPurchasePriceList.ts +30 -0
  966. package/src/modules/purchase/query/getSupplierProfile.generated.ts +5 -0
  967. package/src/modules/purchase/query/getSupplierProfile.test.ts +50 -0
  968. package/src/modules/purchase/query/getSupplierProfile.ts +18 -0
  969. package/src/modules/purchase/tailor.config.ts +13 -0
  970. package/src/modules/purchase/tailor.d.ts +13 -0
  971. package/src/modules/purchase/testing/commandTestUtils.ts +35 -0
  972. package/src/modules/purchase/testing/fixtures.ts +317 -0
  973. package/src/modules/sales/README.md +69 -0
  974. package/src/modules/sales/command/.gitkeep +0 -0
  975. package/src/modules/sales/command/activateChannel.generated.ts +6 -0
  976. package/src/modules/sales/command/activateChannel.test.ts +70 -0
  977. package/src/modules/sales/command/activateChannel.ts +48 -0
  978. package/src/modules/sales/command/activateListing.generated.ts +6 -0
  979. package/src/modules/sales/command/activateListing.test.ts +87 -0
  980. package/src/modules/sales/command/activateListing.ts +49 -0
  981. package/src/modules/sales/command/activateSalesPaymentTerm.generated.ts +6 -0
  982. package/src/modules/sales/command/activateSalesPaymentTerm.test.ts +58 -0
  983. package/src/modules/sales/command/activateSalesPaymentTerm.ts +50 -0
  984. package/src/modules/sales/command/activateSalesPriceList.generated.ts +6 -0
  985. package/src/modules/sales/command/activateSalesPriceList.test.ts +55 -0
  986. package/src/modules/sales/command/activateSalesPriceList.ts +46 -0
  987. package/src/modules/sales/command/activateSalesPriceRule.generated.ts +6 -0
  988. package/src/modules/sales/command/activateSalesPriceRule.test.ts +83 -0
  989. package/src/modules/sales/command/activateSalesPriceRule.ts +58 -0
  990. package/src/modules/sales/command/cancelChannelOrder.generated.ts +6 -0
  991. package/src/modules/sales/command/cancelChannelOrder.test.ts +47 -0
  992. package/src/modules/sales/command/cancelChannelOrder.ts +30 -0
  993. package/src/modules/sales/command/cancelSalesInvoice.generated.ts +6 -0
  994. package/src/modules/sales/command/cancelSalesInvoice.test.ts +47 -0
  995. package/src/modules/sales/command/cancelSalesInvoice.ts +37 -0
  996. package/src/modules/sales/command/cancelSalesOrder.generated.ts +6 -0
  997. package/src/modules/sales/command/cancelSalesOrder.test.ts +70 -0
  998. package/src/modules/sales/command/cancelSalesOrder.ts +48 -0
  999. package/src/modules/sales/command/cancelSyncJob.generated.ts +6 -0
  1000. package/src/modules/sales/command/cancelSyncJob.test.ts +58 -0
  1001. package/src/modules/sales/command/cancelSyncJob.ts +30 -0
  1002. package/src/modules/sales/command/closeSalesOrder.generated.ts +6 -0
  1003. package/src/modules/sales/command/closeSalesOrder.test.ts +41 -0
  1004. package/src/modules/sales/command/closeSalesOrder.ts +51 -0
  1005. package/src/modules/sales/command/confirmSalesOrder.generated.ts +6 -0
  1006. package/src/modules/sales/command/confirmSalesOrder.test.ts +68 -0
  1007. package/src/modules/sales/command/confirmSalesOrder.ts +67 -0
  1008. package/src/modules/sales/command/convertChannelOrder.generated.ts +6 -0
  1009. package/src/modules/sales/command/convertChannelOrder.test.ts +118 -0
  1010. package/src/modules/sales/command/convertChannelOrder.ts +151 -0
  1011. package/src/modules/sales/command/createChannel.generated.ts +6 -0
  1012. package/src/modules/sales/command/createChannel.test.ts +100 -0
  1013. package/src/modules/sales/command/createChannel.ts +58 -0
  1014. package/src/modules/sales/command/createListing.generated.ts +6 -0
  1015. package/src/modules/sales/command/createListing.test.ts +88 -0
  1016. package/src/modules/sales/command/createListing.ts +76 -0
  1017. package/src/modules/sales/command/createSalesCreditNote.generated.ts +6 -0
  1018. package/src/modules/sales/command/createSalesCreditNote.test.ts +56 -0
  1019. package/src/modules/sales/command/createSalesCreditNote.ts +75 -0
  1020. package/src/modules/sales/command/createSalesInvoice.generated.ts +6 -0
  1021. package/src/modules/sales/command/createSalesInvoice.test.ts +85 -0
  1022. package/src/modules/sales/command/createSalesInvoice.ts +94 -0
  1023. package/src/modules/sales/command/createSalesOrder.generated.ts +6 -0
  1024. package/src/modules/sales/command/createSalesOrder.test.ts +134 -0
  1025. package/src/modules/sales/command/createSalesOrder.ts +140 -0
  1026. package/src/modules/sales/command/createSalesPaymentTerm.generated.ts +6 -0
  1027. package/src/modules/sales/command/createSalesPaymentTerm.test.ts +59 -0
  1028. package/src/modules/sales/command/createSalesPaymentTerm.ts +50 -0
  1029. package/src/modules/sales/command/createSalesPriceList.generated.ts +6 -0
  1030. package/src/modules/sales/command/createSalesPriceList.test.ts +67 -0
  1031. package/src/modules/sales/command/createSalesPriceList.ts +45 -0
  1032. package/src/modules/sales/command/createSalesPriceRule.generated.ts +6 -0
  1033. package/src/modules/sales/command/createSalesPriceRule.test.ts +137 -0
  1034. package/src/modules/sales/command/createSalesPriceRule.ts +66 -0
  1035. package/src/modules/sales/command/createShipment.generated.ts +6 -0
  1036. package/src/modules/sales/command/createShipment.test.ts +75 -0
  1037. package/src/modules/sales/command/createShipment.ts +86 -0
  1038. package/src/modules/sales/command/deactivateChannel.generated.ts +6 -0
  1039. package/src/modules/sales/command/deactivateChannel.test.ts +29 -0
  1040. package/src/modules/sales/command/deactivateChannel.ts +30 -0
  1041. package/src/modules/sales/command/deactivateSalesPaymentTerm.generated.ts +6 -0
  1042. package/src/modules/sales/command/deactivateSalesPaymentTerm.test.ts +29 -0
  1043. package/src/modules/sales/command/deactivateSalesPaymentTerm.ts +37 -0
  1044. package/src/modules/sales/command/deactivateSalesPriceList.generated.ts +6 -0
  1045. package/src/modules/sales/command/deactivateSalesPriceList.test.ts +33 -0
  1046. package/src/modules/sales/command/deactivateSalesPriceList.ts +37 -0
  1047. package/src/modules/sales/command/deactivateSalesPriceRule.generated.ts +6 -0
  1048. package/src/modules/sales/command/deactivateSalesPriceRule.test.ts +33 -0
  1049. package/src/modules/sales/command/deactivateSalesPriceRule.ts +37 -0
  1050. package/src/modules/sales/command/issueSalesCreditNote.generated.ts +6 -0
  1051. package/src/modules/sales/command/issueSalesCreditNote.test.ts +62 -0
  1052. package/src/modules/sales/command/issueSalesCreditNote.ts +71 -0
  1053. package/src/modules/sales/command/issueSalesInvoice.generated.ts +6 -0
  1054. package/src/modules/sales/command/issueSalesInvoice.test.ts +88 -0
  1055. package/src/modules/sales/command/issueSalesInvoice.ts +115 -0
  1056. package/src/modules/sales/command/markChannelOrderException.generated.ts +6 -0
  1057. package/src/modules/sales/command/markChannelOrderException.test.ts +59 -0
  1058. package/src/modules/sales/command/markChannelOrderException.ts +49 -0
  1059. package/src/modules/sales/command/pauseListing.generated.ts +6 -0
  1060. package/src/modules/sales/command/pauseListing.test.ts +40 -0
  1061. package/src/modules/sales/command/pauseListing.ts +30 -0
  1062. package/src/modules/sales/command/placeSalesOrderOnCreditHold.generated.ts +6 -0
  1063. package/src/modules/sales/command/placeSalesOrderOnCreditHold.test.ts +74 -0
  1064. package/src/modules/sales/command/placeSalesOrderOnCreditHold.ts +46 -0
  1065. package/src/modules/sales/command/postShipment.generated.ts +6 -0
  1066. package/src/modules/sales/command/postShipment.test.ts +97 -0
  1067. package/src/modules/sales/command/postShipment.ts +89 -0
  1068. package/src/modules/sales/command/recordChannelOrder.generated.ts +6 -0
  1069. package/src/modules/sales/command/recordChannelOrder.test.ts +124 -0
  1070. package/src/modules/sales/command/recordChannelOrder.ts +93 -0
  1071. package/src/modules/sales/command/rejectSalesOrder.generated.ts +6 -0
  1072. package/src/modules/sales/command/rejectSalesOrder.test.ts +78 -0
  1073. package/src/modules/sales/command/rejectSalesOrder.ts +42 -0
  1074. package/src/modules/sales/command/releaseSalesOrderCreditHold.generated.ts +6 -0
  1075. package/src/modules/sales/command/releaseSalesOrderCreditHold.test.ts +50 -0
  1076. package/src/modules/sales/command/releaseSalesOrderCreditHold.ts +51 -0
  1077. package/src/modules/sales/command/retireListing.generated.ts +6 -0
  1078. package/src/modules/sales/command/retireListing.test.ts +42 -0
  1079. package/src/modules/sales/command/retireListing.ts +30 -0
  1080. package/src/modules/sales/command/retrySyncJob.generated.ts +6 -0
  1081. package/src/modules/sales/command/retrySyncJob.test.ts +54 -0
  1082. package/src/modules/sales/command/retrySyncJob.ts +44 -0
  1083. package/src/modules/sales/command/sendSalesInvoice.generated.ts +6 -0
  1084. package/src/modules/sales/command/sendSalesInvoice.test.ts +50 -0
  1085. package/src/modules/sales/command/sendSalesInvoice.ts +43 -0
  1086. package/src/modules/sales/command/startSyncJob.generated.ts +6 -0
  1087. package/src/modules/sales/command/startSyncJob.test.ts +65 -0
  1088. package/src/modules/sales/command/startSyncJob.ts +54 -0
  1089. package/src/modules/sales/command/submitSalesOrder.generated.ts +6 -0
  1090. package/src/modules/sales/command/submitSalesOrder.test.ts +58 -0
  1091. package/src/modules/sales/command/submitSalesOrder.ts +49 -0
  1092. package/src/modules/sales/command/updateChannel.generated.ts +6 -0
  1093. package/src/modules/sales/command/updateChannel.test.ts +71 -0
  1094. package/src/modules/sales/command/updateChannel.ts +68 -0
  1095. package/src/modules/sales/command/updateListing.generated.ts +6 -0
  1096. package/src/modules/sales/command/updateListing.test.ts +56 -0
  1097. package/src/modules/sales/command/updateListing.ts +60 -0
  1098. package/src/modules/sales/command/updateSalesCreditNote.generated.ts +6 -0
  1099. package/src/modules/sales/command/updateSalesCreditNote.test.ts +68 -0
  1100. package/src/modules/sales/command/updateSalesCreditNote.ts +68 -0
  1101. package/src/modules/sales/command/updateSalesInvoice.generated.ts +6 -0
  1102. package/src/modules/sales/command/updateSalesInvoice.test.ts +73 -0
  1103. package/src/modules/sales/command/updateSalesInvoice.ts +80 -0
  1104. package/src/modules/sales/command/updateSalesOrder.generated.ts +6 -0
  1105. package/src/modules/sales/command/updateSalesOrder.test.ts +93 -0
  1106. package/src/modules/sales/command/updateSalesOrder.ts +121 -0
  1107. package/src/modules/sales/command/updateSalesPaymentTerm.generated.ts +6 -0
  1108. package/src/modules/sales/command/updateSalesPaymentTerm.test.ts +66 -0
  1109. package/src/modules/sales/command/updateSalesPaymentTerm.ts +59 -0
  1110. package/src/modules/sales/command/updateSalesPriceList.generated.ts +6 -0
  1111. package/src/modules/sales/command/updateSalesPriceList.test.ts +71 -0
  1112. package/src/modules/sales/command/updateSalesPriceList.ts +52 -0
  1113. package/src/modules/sales/command/updateSalesPriceRule.generated.ts +6 -0
  1114. package/src/modules/sales/command/updateSalesPriceRule.test.ts +95 -0
  1115. package/src/modules/sales/command/updateSalesPriceRule.ts +81 -0
  1116. package/src/modules/sales/command/updateShipment.generated.ts +6 -0
  1117. package/src/modules/sales/command/updateShipment.test.ts +78 -0
  1118. package/src/modules/sales/command/updateShipment.ts +84 -0
  1119. package/src/modules/sales/db/.gitkeep +0 -0
  1120. package/src/modules/sales/db/channel.ts +43 -0
  1121. package/src/modules/sales/db/channelOrder.ts +109 -0
  1122. package/src/modules/sales/db/channelOrderLine.ts +84 -0
  1123. package/src/modules/sales/db/listing.ts +81 -0
  1124. package/src/modules/sales/db/salesCreditNote.ts +63 -0
  1125. package/src/modules/sales/db/salesCreditNoteLine.ts +49 -0
  1126. package/src/modules/sales/db/salesInvoice.ts +95 -0
  1127. package/src/modules/sales/db/salesInvoiceLine.ts +64 -0
  1128. package/src/modules/sales/db/salesOrder.ts +103 -0
  1129. package/src/modules/sales/db/salesOrderLine.ts +82 -0
  1130. package/src/modules/sales/db/salesPaymentTerm.ts +46 -0
  1131. package/src/modules/sales/db/salesPriceList.ts +61 -0
  1132. package/src/modules/sales/db/salesPriceRule.ts +96 -0
  1133. package/src/modules/sales/db/shipment.ts +78 -0
  1134. package/src/modules/sales/db/shipmentLine.ts +58 -0
  1135. package/src/modules/sales/db/syncJob.ts +70 -0
  1136. package/src/modules/sales/docs/commands/ActivateChannel.md +42 -0
  1137. package/src/modules/sales/docs/commands/ActivateListing.md +46 -0
  1138. package/src/modules/sales/docs/commands/ActivateSalesPaymentTerm.md +41 -0
  1139. package/src/modules/sales/docs/commands/ActivateSalesPriceList.md +39 -0
  1140. package/src/modules/sales/docs/commands/ActivateSalesPriceRule.md +48 -0
  1141. package/src/modules/sales/docs/commands/CancelChannelOrder.md +37 -0
  1142. package/src/modules/sales/docs/commands/CancelSalesInvoice.md +39 -0
  1143. package/src/modules/sales/docs/commands/CancelSalesOrder.md +40 -0
  1144. package/src/modules/sales/docs/commands/CancelSyncJob.md +36 -0
  1145. package/src/modules/sales/docs/commands/CloseSalesOrder.md +39 -0
  1146. package/src/modules/sales/docs/commands/ConfirmSalesOrder.md +43 -0
  1147. package/src/modules/sales/docs/commands/ConvertChannelOrder.md +44 -0
  1148. package/src/modules/sales/docs/commands/CreateChannel.md +40 -0
  1149. package/src/modules/sales/docs/commands/CreateListing.md +40 -0
  1150. package/src/modules/sales/docs/commands/CreateSalesCreditNote.md +37 -0
  1151. package/src/modules/sales/docs/commands/CreateSalesInvoice.md +39 -0
  1152. package/src/modules/sales/docs/commands/CreateSalesOrder.md +51 -0
  1153. package/src/modules/sales/docs/commands/CreateSalesPaymentTerm.md +38 -0
  1154. package/src/modules/sales/docs/commands/CreateSalesPriceList.md +37 -0
  1155. package/src/modules/sales/docs/commands/CreateSalesPriceRule.md +46 -0
  1156. package/src/modules/sales/docs/commands/CreateShipment.md +38 -0
  1157. package/src/modules/sales/docs/commands/DeactivateChannel.md +35 -0
  1158. package/src/modules/sales/docs/commands/DeactivateSalesPaymentTerm.md +35 -0
  1159. package/src/modules/sales/docs/commands/DeactivateSalesPriceList.md +35 -0
  1160. package/src/modules/sales/docs/commands/DeactivateSalesPriceRule.md +35 -0
  1161. package/src/modules/sales/docs/commands/IssueSalesCreditNote.md +38 -0
  1162. package/src/modules/sales/docs/commands/IssueSalesInvoice.md +43 -0
  1163. package/src/modules/sales/docs/commands/MarkChannelOrderException.md +37 -0
  1164. package/src/modules/sales/docs/commands/PauseListing.md +36 -0
  1165. package/src/modules/sales/docs/commands/PlaceSalesOrderOnCreditHold.md +41 -0
  1166. package/src/modules/sales/docs/commands/PostShipment.md +41 -0
  1167. package/src/modules/sales/docs/commands/RecordChannelOrder.md +45 -0
  1168. package/src/modules/sales/docs/commands/RejectSalesOrder.md +41 -0
  1169. package/src/modules/sales/docs/commands/ReleaseSalesOrderCreditHold.md +36 -0
  1170. package/src/modules/sales/docs/commands/RetireListing.md +36 -0
  1171. package/src/modules/sales/docs/commands/RetrySyncJob.md +39 -0
  1172. package/src/modules/sales/docs/commands/SendSalesInvoice.md +38 -0
  1173. package/src/modules/sales/docs/commands/StartSyncJob.md +39 -0
  1174. package/src/modules/sales/docs/commands/SubmitSalesOrder.md +43 -0
  1175. package/src/modules/sales/docs/commands/UpdateChannel.md +43 -0
  1176. package/src/modules/sales/docs/commands/UpdateListing.md +38 -0
  1177. package/src/modules/sales/docs/commands/UpdateSalesCreditNote.md +38 -0
  1178. package/src/modules/sales/docs/commands/UpdateSalesInvoice.md +38 -0
  1179. package/src/modules/sales/docs/commands/UpdateSalesOrder.md +45 -0
  1180. package/src/modules/sales/docs/commands/UpdateSalesPaymentTerm.md +41 -0
  1181. package/src/modules/sales/docs/commands/UpdateSalesPriceList.md +40 -0
  1182. package/src/modules/sales/docs/commands/UpdateSalesPriceRule.md +49 -0
  1183. package/src/modules/sales/docs/commands/UpdateShipment.md +38 -0
  1184. package/src/modules/sales/docs/commands/bin/rm.md +52 -0
  1185. package/src/modules/sales/docs/commands/opt/homebrew/bin/codex.md +52 -0
  1186. package/src/modules/sales/docs/commands/opt/homebrew/bin/ps2ps2.md +52 -0
  1187. package/src/modules/sales/docs/commands/opt/homebrew/bin/rg.md +52 -0
  1188. package/src/modules/sales/docs/commands/opt/homebrew/bin/sha384sum.md +52 -0
  1189. package/src/modules/sales/docs/commands/opt/homebrew/opt/libpq/bin/pg_combinebackup.md +52 -0
  1190. package/src/modules/sales/docs/commands/sbin/mount_msdos.md +52 -0
  1191. package/src/modules/sales/docs/commands/sbin/mount_nfs.md +52 -0
  1192. package/src/modules/sales/docs/commands/usr/bin/cupstestppd.md +52 -0
  1193. package/src/modules/sales/docs/commands/usr/bin/enc2xs.md +52 -0
  1194. package/src/modules/sales/docs/commands/usr/bin/hash.md +52 -0
  1195. package/src/modules/sales/docs/commands/usr/bin/jarsigner.md +52 -0
  1196. package/src/modules/sales/docs/commands/usr/bin/mpsgraphtool.md +52 -0
  1197. package/src/modules/sales/docs/commands/usr/bin/nano.md +52 -0
  1198. package/src/modules/sales/docs/commands/usr/bin/pod2html5.34.md +52 -0
  1199. package/src/modules/sales/docs/commands/usr/bin/ri.md +52 -0
  1200. package/src/modules/sales/docs/commands/usr/bin/rs.md +52 -0
  1201. package/src/modules/sales/docs/commands/usr/bin/trustcachectl.md +52 -0
  1202. package/src/modules/sales/docs/commands/usr/sbin/htpasswd.md +52 -0
  1203. package/src/modules/sales/docs/commands/usr/sbin/lpadmin.md +52 -0
  1204. package/src/modules/sales/docs/commands/usr/sbin/setkey.md +52 -0
  1205. package/src/modules/sales/docs/features/channel-listing-management.md +68 -0
  1206. package/src/modules/sales/docs/features/channel-order-sync.md +78 -0
  1207. package/src/modules/sales/docs/features/customer-invoicing.md +89 -0
  1208. package/src/modules/sales/docs/features/customer-sales-pricing.md +72 -0
  1209. package/src/modules/sales/docs/features/sales-order-lifecycle.md +96 -0
  1210. package/src/modules/sales/docs/features/sales-payment-terms.md +67 -0
  1211. package/src/modules/sales/docs/features/shipment-fulfillment.md +71 -0
  1212. package/src/modules/sales/docs/models/Channel.md +48 -0
  1213. package/src/modules/sales/docs/models/ChannelOrder.md +56 -0
  1214. package/src/modules/sales/docs/models/ChannelOrderLine.md +39 -0
  1215. package/src/modules/sales/docs/models/Listing.md +56 -0
  1216. package/src/modules/sales/docs/models/SalesCreditNote.md +47 -0
  1217. package/src/modules/sales/docs/models/SalesCreditNoteLine.md +37 -0
  1218. package/src/modules/sales/docs/models/SalesInvoice.md +55 -0
  1219. package/src/modules/sales/docs/models/SalesInvoiceLine.md +39 -0
  1220. package/src/modules/sales/docs/models/SalesOrder.md +79 -0
  1221. package/src/modules/sales/docs/models/SalesOrderLine.md +42 -0
  1222. package/src/modules/sales/docs/models/SalesPaymentTerm.md +53 -0
  1223. package/src/modules/sales/docs/models/SalesPriceList.md +50 -0
  1224. package/src/modules/sales/docs/models/SalesPriceRule.md +51 -0
  1225. package/src/modules/sales/docs/models/Shipment.md +49 -0
  1226. package/src/modules/sales/docs/models/ShipmentLine.md +38 -0
  1227. package/src/modules/sales/docs/models/SyncJob.md +53 -0
  1228. package/src/modules/sales/docs/queries/CalculateInvoiceDueSchedule.md +37 -0
  1229. package/src/modules/sales/docs/queries/GetApplicableSalesPrice.md +38 -0
  1230. package/src/modules/sales/docs/queries/GetChannel.md +34 -0
  1231. package/src/modules/sales/docs/queries/GetChannelOrder.md +34 -0
  1232. package/src/modules/sales/docs/queries/GetListing.md +34 -0
  1233. package/src/modules/sales/docs/queries/GetListingByExternalIdentifier.md +35 -0
  1234. package/src/modules/sales/docs/queries/GetSalesCreditNote.md +34 -0
  1235. package/src/modules/sales/docs/queries/GetSalesInvoice.md +34 -0
  1236. package/src/modules/sales/docs/queries/GetSalesOrder.md +36 -0
  1237. package/src/modules/sales/docs/queries/GetSalesPaymentTerm.md +34 -0
  1238. package/src/modules/sales/docs/queries/GetSalesPriceList.md +34 -0
  1239. package/src/modules/sales/docs/queries/GetShipment.md +34 -0
  1240. package/src/modules/sales/docs/queries/GetSyncJob.md +34 -0
  1241. package/src/modules/sales/docs/queries/ListChannelOrdersByStatus.md +34 -0
  1242. package/src/modules/sales/docs/queries/ListChannels.md +33 -0
  1243. package/src/modules/sales/docs/queries/ListListingsByChannel.md +33 -0
  1244. package/src/modules/sales/docs/queries/ListSalesCreditNotesByInvoice.md +33 -0
  1245. package/src/modules/sales/docs/queries/ListSalesInvoicesBySalesOrder.md +33 -0
  1246. package/src/modules/sales/docs/queries/ListSalesOrders.md +36 -0
  1247. package/src/modules/sales/docs/queries/ListSalesPaymentTerms.md +33 -0
  1248. package/src/modules/sales/docs/queries/ListSalesPriceLists.md +33 -0
  1249. package/src/modules/sales/docs/queries/ListSalesPriceRulesByPriceList.md +33 -0
  1250. package/src/modules/sales/docs/queries/ListShipmentsBySalesOrder.md +33 -0
  1251. package/src/modules/sales/docs/queries/ListSyncJobs.md +34 -0
  1252. package/src/modules/sales/executor/.gitkeep +0 -0
  1253. package/src/modules/sales/generated/.gitkeep +0 -0
  1254. package/src/modules/sales/generated/enums.ts +119 -0
  1255. package/src/modules/sales/generated/kysely-tailordb.ts +332 -0
  1256. package/src/modules/sales/index.ts +2 -0
  1257. package/src/modules/sales/lib/_db_deps.ts +67 -0
  1258. package/src/modules/sales/lib/domain.ts +354 -0
  1259. package/src/modules/sales/lib/errors.generated.ts +417 -0
  1260. package/src/modules/sales/lib/permissions.generated.ts +53 -0
  1261. package/src/modules/sales/lib/repository.ts +137 -0
  1262. package/src/modules/sales/lib/types.ts +105 -0
  1263. package/src/modules/sales/module.ts +418 -0
  1264. package/src/modules/sales/permissions.ts +3 -0
  1265. package/src/modules/sales/query/.gitkeep +0 -0
  1266. package/src/modules/sales/query/calculateInvoiceDueSchedule.generated.ts +5 -0
  1267. package/src/modules/sales/query/calculateInvoiceDueSchedule.test.ts +107 -0
  1268. package/src/modules/sales/query/calculateInvoiceDueSchedule.ts +35 -0
  1269. package/src/modules/sales/query/getApplicableSalesPrice.generated.ts +5 -0
  1270. package/src/modules/sales/query/getApplicableSalesPrice.test.ts +110 -0
  1271. package/src/modules/sales/query/getApplicableSalesPrice.ts +81 -0
  1272. package/src/modules/sales/query/getChannel.generated.ts +5 -0
  1273. package/src/modules/sales/query/getChannel.test.ts +39 -0
  1274. package/src/modules/sales/query/getChannel.ts +15 -0
  1275. package/src/modules/sales/query/getChannelOrder.generated.ts +5 -0
  1276. package/src/modules/sales/query/getChannelOrder.test.ts +50 -0
  1277. package/src/modules/sales/query/getChannelOrder.ts +29 -0
  1278. package/src/modules/sales/query/getListing.generated.ts +5 -0
  1279. package/src/modules/sales/query/getListing.test.ts +39 -0
  1280. package/src/modules/sales/query/getListing.ts +15 -0
  1281. package/src/modules/sales/query/getListingByExternalIdentifier.generated.ts +5 -0
  1282. package/src/modules/sales/query/getListingByExternalIdentifier.test.ts +61 -0
  1283. package/src/modules/sales/query/getListingByExternalIdentifier.ts +23 -0
  1284. package/src/modules/sales/query/getSalesCreditNote.generated.ts +5 -0
  1285. package/src/modules/sales/query/getSalesCreditNote.test.ts +44 -0
  1286. package/src/modules/sales/query/getSalesCreditNote.ts +14 -0
  1287. package/src/modules/sales/query/getSalesInvoice.generated.ts +5 -0
  1288. package/src/modules/sales/query/getSalesInvoice.test.ts +44 -0
  1289. package/src/modules/sales/query/getSalesInvoice.ts +14 -0
  1290. package/src/modules/sales/query/getSalesOrder.generated.ts +5 -0
  1291. package/src/modules/sales/query/getSalesOrder.test.ts +57 -0
  1292. package/src/modules/sales/query/getSalesOrder.ts +20 -0
  1293. package/src/modules/sales/query/getSalesPaymentTerm.generated.ts +5 -0
  1294. package/src/modules/sales/query/getSalesPaymentTerm.test.ts +44 -0
  1295. package/src/modules/sales/query/getSalesPaymentTerm.ts +24 -0
  1296. package/src/modules/sales/query/getSalesPriceList.generated.ts +5 -0
  1297. package/src/modules/sales/query/getSalesPriceList.test.ts +39 -0
  1298. package/src/modules/sales/query/getSalesPriceList.ts +15 -0
  1299. package/src/modules/sales/query/getShipment.generated.ts +5 -0
  1300. package/src/modules/sales/query/getShipment.test.ts +44 -0
  1301. package/src/modules/sales/query/getShipment.ts +12 -0
  1302. package/src/modules/sales/query/getSyncJob.generated.ts +5 -0
  1303. package/src/modules/sales/query/getSyncJob.test.ts +43 -0
  1304. package/src/modules/sales/query/getSyncJob.ts +24 -0
  1305. package/src/modules/sales/query/listChannelOrdersByStatus.generated.ts +5 -0
  1306. package/src/modules/sales/query/listChannelOrdersByStatus.test.ts +58 -0
  1307. package/src/modules/sales/query/listChannelOrdersByStatus.ts +53 -0
  1308. package/src/modules/sales/query/listChannels.generated.ts +5 -0
  1309. package/src/modules/sales/query/listChannels.test.ts +36 -0
  1310. package/src/modules/sales/query/listChannels.ts +39 -0
  1311. package/src/modules/sales/query/listListingsByChannel.generated.ts +5 -0
  1312. package/src/modules/sales/query/listListingsByChannel.test.ts +36 -0
  1313. package/src/modules/sales/query/listListingsByChannel.ts +39 -0
  1314. package/src/modules/sales/query/listSalesCreditNotesByInvoice.generated.ts +5 -0
  1315. package/src/modules/sales/query/listSalesCreditNotesByInvoice.test.ts +36 -0
  1316. package/src/modules/sales/query/listSalesCreditNotesByInvoice.ts +42 -0
  1317. package/src/modules/sales/query/listSalesInvoicesBySalesOrder.generated.ts +5 -0
  1318. package/src/modules/sales/query/listSalesInvoicesBySalesOrder.test.ts +36 -0
  1319. package/src/modules/sales/query/listSalesInvoicesBySalesOrder.ts +42 -0
  1320. package/src/modules/sales/query/listSalesOrders.generated.ts +5 -0
  1321. package/src/modules/sales/query/listSalesOrders.test.ts +79 -0
  1322. package/src/modules/sales/query/listSalesOrders.ts +67 -0
  1323. package/src/modules/sales/query/listSalesPaymentTerms.generated.ts +5 -0
  1324. package/src/modules/sales/query/listSalesPaymentTerms.test.ts +36 -0
  1325. package/src/modules/sales/query/listSalesPaymentTerms.ts +42 -0
  1326. package/src/modules/sales/query/listSalesPriceLists.generated.ts +5 -0
  1327. package/src/modules/sales/query/listSalesPriceLists.test.ts +36 -0
  1328. package/src/modules/sales/query/listSalesPriceLists.ts +39 -0
  1329. package/src/modules/sales/query/listSalesPriceRulesByPriceList.generated.ts +5 -0
  1330. package/src/modules/sales/query/listSalesPriceRulesByPriceList.test.ts +39 -0
  1331. package/src/modules/sales/query/listSalesPriceRulesByPriceList.ts +47 -0
  1332. package/src/modules/sales/query/listShipmentsBySalesOrder.generated.ts +5 -0
  1333. package/src/modules/sales/query/listShipmentsBySalesOrder.test.ts +36 -0
  1334. package/src/modules/sales/query/listShipmentsBySalesOrder.ts +36 -0
  1335. package/src/modules/sales/query/listSyncJobs.generated.ts +5 -0
  1336. package/src/modules/sales/query/listSyncJobs.test.ts +50 -0
  1337. package/src/modules/sales/query/listSyncJobs.ts +47 -0
  1338. package/src/modules/sales/tailor.config.ts +13 -0
  1339. package/src/modules/sales/tailor.d.ts +13 -0
  1340. package/src/modules/sales/testing/commandTestUtils.ts +35 -0
  1341. package/src/modules/sales/testing/fixtures.ts +520 -0
  1342. package/src/modules/user-management/command/.gitkeep +0 -0
  1343. package/src/modules/user-management/command/activateUser.generated.ts +1 -1
  1344. package/src/modules/user-management/command/activateUser.ts +1 -1
  1345. package/src/modules/user-management/command/assignPermissionToRole.generated.ts +1 -1
  1346. package/src/modules/user-management/command/assignPermissionToRole.ts +1 -1
  1347. package/src/modules/user-management/command/assignRoleToUser.generated.ts +1 -1
  1348. package/src/modules/user-management/command/assignRoleToUser.ts +1 -1
  1349. package/src/modules/user-management/command/createPermission.generated.ts +1 -1
  1350. package/src/modules/user-management/command/createPermission.ts +1 -1
  1351. package/src/modules/user-management/command/createRole.generated.ts +1 -1
  1352. package/src/modules/user-management/command/createRole.ts +1 -1
  1353. package/src/modules/user-management/command/createUser.generated.ts +1 -1
  1354. package/src/modules/user-management/command/createUser.ts +1 -1
  1355. package/src/modules/user-management/command/deactivateUser.generated.ts +1 -1
  1356. package/src/modules/user-management/command/deactivateUser.ts +1 -1
  1357. package/src/modules/user-management/command/reactivateUser.generated.ts +1 -1
  1358. package/src/modules/user-management/command/reactivateUser.ts +1 -1
  1359. package/src/modules/user-management/command/revokePermissionFromRole.generated.ts +1 -1
  1360. package/src/modules/user-management/command/revokePermissionFromRole.ts +1 -1
  1361. package/src/modules/user-management/command/revokeRoleFromUser.generated.ts +1 -1
  1362. package/src/modules/user-management/command/revokeRoleFromUser.ts +1 -1
  1363. package/src/modules/user-management/db/.gitkeep +0 -0
  1364. package/src/modules/user-management/executor/.gitkeep +0 -0
  1365. package/src/modules/user-management/generated/.gitkeep +0 -0
  1366. package/src/modules/user-management/lib/errors.generated.ts +1 -6
  1367. package/src/modules/user-management/lib/permissions.generated.ts +1 -1
  1368. package/src/modules/user-management/lib/recomputeUserPermissions.ts +4 -2
  1369. package/src/modules/user-management/lib/types.ts +6 -1
  1370. package/src/modules/user-management/module.ts +1 -1
  1371. package/src/modules/user-management/permissions.ts +3 -0
  1372. package/src/modules/user-management/query/.gitkeep +0 -0
  1373. package/src/modules/user-management/query/listRolePermissionsByRole.generated.ts +5 -0
  1374. package/src/modules/user-management/query/listRolePermissionsByRole.test.ts +20 -0
  1375. package/src/modules/user-management/query/listRolePermissionsByRole.ts +28 -0
  1376. package/src/modules/user-management/query/listUserRolesByUser.generated.ts +5 -0
  1377. package/src/modules/user-management/query/listUserRolesByUser.test.ts +20 -0
  1378. package/src/modules/user-management/query/listUserRolesByUser.ts +28 -0
  1379. package/src/schemas.ts +6 -6
  1380. package/src/shared/defineCommand.ts +1 -1
  1381. package/src/shared/entityTypes.ts +1 -1
  1382. package/src/shared/uuidv5.test.ts +18 -0
  1383. package/src/shared/uuidv5.ts +23 -0
  1384. package/src/testing/index.ts +1 -1
  1385. package/templates/scaffold/app/backend/package.json +1 -3
  1386. package/templates/scaffold/app/backend/seed/exec.mjs +7 -5
  1387. package/templates/scaffold/app/backend/src/generated/kysely-tailordb.ts +0 -11
  1388. package/templates/scaffold/module/lib/types.ts +6 -1
  1389. package/templates/scaffold/module/permissions.ts +1 -1
  1390. package/templates/scaffold/module/seed/index.ts +19 -0
  1391. package/src/modules/business-partner/lib/errors.ts +0 -2
  1392. package/src/modules/organization/lib/errors.ts +0 -1
  1393. package/templates/scaffold/module/lib/errors.ts +0 -1
  1394. /package/schemas/{app-compose → app}/actors.yml +0 -0
  1395. /package/schemas/{app-compose → app}/business-flow.yml +0 -0
  1396. /package/schemas/{app-compose → app}/requirements.yml +0 -0
  1397. /package/schemas/{app-compose → app}/resolver.yml +0 -0
  1398. /package/schemas/{app-compose → app}/screen.yml +0 -0
  1399. /package/schemas/{app-compose → app}/story.yml +0 -0
  1400. /package/src/modules/{purchase → inventory/command}/.gitkeep +0 -0
  1401. /package/src/modules/{audit/lib/errors.ts → inventory/db/.gitkeep} +0 -0
  1402. /package/src/modules/{coa-management/lib/errors.ts → inventory/executor/.gitkeep} +0 -0
@@ -0,0 +1,50 @@
1
+ # SetSupplierDefaultPurchasePaymentTerm
2
+
3
+ ## Overview
4
+
5
+ SetSupplierDefaultPurchasePaymentTerm creates or updates the purchase-owned supplier profile for a company and assigns the default payment term used when new draft purchase orders are created for that supplier.
6
+
7
+ ## Business Rules
8
+
9
+ - Supplier must exist and carry the `SUPPLIER` role
10
+ - Supplier profile is unique per `companyId + supplierId`
11
+ - Assigned payment term must exist, belong to the same company, and be active for new draft defaulting
12
+ - Passing the same default term as the current profile is idempotent
13
+ - Clearing the default term is allowed and preserves the supplier profile record for future procurement settings
14
+
15
+ ## Process Flow
16
+
17
+ ```mermaid
18
+ flowchart TD
19
+ A[Receive supplier + company + paymentTermId] --> B{Supplier exists and is a SUPPLIER?}
20
+ B -->|No| C[Return supplier error]
21
+ B -->|Yes| D{Payment term provided?}
22
+ D -->|Yes| E{Payment term exists, same company, active?}
23
+ D -->|No| G[Upsert supplier profile with cleared default]
24
+ E -->|No| F[Return payment term error]
25
+ E -->|Yes| G[Upsert supplier profile with default term]
26
+ G --> H[Return supplier profile]
27
+ ```
28
+
29
+ ## External Dependencies
30
+
31
+ - [business-partner::GetPartner](../../../business-partner/docs/queries/GetPartner.md) - Validate the supplier reference and partner role
32
+
33
+ ## Error Scenarios
34
+
35
+ - **SUPPLIER_NOT_FOUND**: Supplier partner does not exist
36
+ - **PARTNER_NOT_SUPPLIER**: Referenced partner does not carry the `SUPPLIER` role
37
+ - **PAYMENT_TERM_NOT_FOUND**: Referenced purchase payment term does not exist
38
+ - **PAYMENT_TERM_INACTIVE**: Referenced purchase payment term is inactive and cannot be used as a default
39
+ - **COMPANY_SCOPE_MISMATCH**: Supplier profile company does not match the payment term company
40
+
41
+ ## Test Cases
42
+
43
+ - creates a supplier profile when none exists
44
+ - updates the default payment term on an existing supplier profile
45
+ - clears the default payment term when explicit null is provided
46
+ - returns error when supplier does not exist
47
+ - returns error when partner is not a supplier
48
+ - returns error when payment term does not exist
49
+ - returns error when payment term is inactive
50
+ - returns error when payment term belongs to a different company
@@ -0,0 +1,51 @@
1
+ # SubmitPurchaseOrder
2
+
3
+ ## Overview
4
+
5
+ SubmitPurchaseOrder validates that a draft purchase order is commercially complete and moves it into `SUBMITTED` status for review or approval.
6
+
7
+ ## Business Rules
8
+
9
+ - Target purchase order must exist
10
+ - Only orders in `DRAFT` status can be submitted
11
+ - Submitted orders must contain at least one line
12
+ - Every physical line must have a receiving site
13
+ - Supplier must still carry the `SUPPLIER` role at submission time
14
+ - External supplier order reference must be unique within the company when provided
15
+
16
+ ## Process Flow
17
+
18
+ ```mermaid
19
+ flowchart TD
20
+ A[Receive submit request] --> B{Purchase order exists and is DRAFT?}
21
+ B -->|No| C[Return not found or invalid status]
22
+ B -->|Yes| D{At least one valid line?}
23
+ D -->|No| E[Return line validation error]
24
+ D -->|Yes| F{Supplier and external reference valid?}
25
+ F -->|No| G[Return supplier or duplicate reference error]
26
+ F -->|Yes| H[Set status to SUBMITTED]
27
+ H --> I[Return submitted order]
28
+ ```
29
+
30
+ ## External Dependencies
31
+
32
+ - [business-partner::GetPartner](../../../business-partner/docs/queries/GetPartner.md) - Re-validate supplier role and status
33
+
34
+ ## Error Scenarios
35
+
36
+ - **PURCHASE_ORDER_NOT_FOUND**: Target purchase order does not exist
37
+ - **PURCHASE_ORDER_NOT_DRAFT**: Purchase order is not in `DRAFT` status
38
+ - **EMPTY_PURCHASE_ORDER_LINES**: Purchase order has no lines
39
+ - **RECEIVING_SITE_REQUIRED**: A physical-receipt line has no receiving site
40
+ - **PARTNER_NOT_SUPPLIER**: Supplier no longer carries the `SUPPLIER` role
41
+ - **DUPLICATE_EXTERNAL_SUPPLIER_ORDER_REFERENCE**: Another order already uses the same external supplier order reference in the company
42
+
43
+ ## Test Cases
44
+
45
+ - submits a valid draft purchase order
46
+ - returns error when purchase order does not exist
47
+ - returns error when purchase order is not in draft
48
+ - returns error when purchase order has no lines
49
+ - returns error when a physical line has no receiving site
50
+ - returns error when supplier is no longer classified as a supplier
51
+ - returns error when external supplier order reference is duplicated
@@ -0,0 +1,48 @@
1
+ # UpdateGoodsReceipt
2
+
3
+ ## Overview
4
+
5
+ UpdateGoodsReceipt changes draft receipt quantities, receipt dates, or targeted lines before the receipt is posted.
6
+
7
+ ## Business Rules
8
+
9
+ - Target goods receipt must exist
10
+ - Only receipts in `DRAFT` status can be updated
11
+ - Updated lines must satisfy the same validation rules as create
12
+ - Posted receipts are immutable and must be corrected by a future compensating workflow instead of update
13
+
14
+ ## Process Flow
15
+
16
+ ```mermaid
17
+ flowchart TD
18
+ A[Receive update request] --> B{Goods receipt exists?}
19
+ B -->|No| C[Return GOODS_RECEIPT_NOT_FOUND]
20
+ B -->|Yes| D{Status is DRAFT?}
21
+ D -->|No| E[Return GOODS_RECEIPT_NOT_DRAFT]
22
+ D -->|Yes| F{Updated lines valid?}
23
+ F -->|No| G[Return validation error]
24
+ F -->|Yes| H[Update draft receipt]
25
+ H --> I[Return updated receipt]
26
+ ```
27
+
28
+ ## External Dependencies
29
+
30
+ - None
31
+
32
+ ## Error Scenarios
33
+
34
+ - **GOODS_RECEIPT_NOT_FOUND**: Target goods receipt does not exist
35
+ - **GOODS_RECEIPT_NOT_DRAFT**: Goods receipt is not in `DRAFT` status
36
+ - **PURCHASE_ORDER_LINE_NOT_FOUND**: Referenced purchase-order line does not exist
37
+ - **NO_OPEN_RECEIPT_QUANTITY**: Purchase-order line has no remaining open quantity to receive
38
+ - **INVALID_RECEIVED_QUANTITY**: Received quantity is zero or negative
39
+
40
+ ## Test Cases
41
+
42
+ - updates quantities on a draft goods receipt
43
+ - updates receipt date on a draft goods receipt
44
+ - returns error when goods receipt does not exist
45
+ - returns error when goods receipt is not draft
46
+ - returns error when updated line data is invalid
47
+ - returns error when an updated receipt quantity is not positive
48
+ - returns error when an updated receipt line has no open quantity remaining
@@ -0,0 +1,51 @@
1
+ # UpdatePurchaseBill
2
+
3
+ ## Overview
4
+
5
+ UpdatePurchaseBill revises draft supplier bill content before procurement matching is finalized.
6
+
7
+ ## Business Rules
8
+
9
+ - Target purchase bill must exist
10
+ - Only bills in `DRAFT` status can be updated
11
+ - Updated invoice number must still be unique within supplier and company
12
+ - Updated lines must satisfy the same validation rules as create
13
+ - Once a bill has been matched, blocked, or cancelled, its comparison evidence is immutable
14
+
15
+ ## Process Flow
16
+
17
+ ```mermaid
18
+ flowchart TD
19
+ A[Receive update request] --> B{Purchase bill exists?}
20
+ B -->|No| C[Return PURCHASE_BILL_NOT_FOUND]
21
+ B -->|Yes| D{Status is DRAFT?}
22
+ D -->|No| E[Return PURCHASE_BILL_NOT_DRAFT]
23
+ D -->|Yes| F{Invoice number unique and lines valid?}
24
+ F -->|No| G[Return validation error]
25
+ F -->|Yes| H[Update draft bill]
26
+ H --> I[Return updated bill]
27
+ ```
28
+
29
+ ## External Dependencies
30
+
31
+ - [business-partner::ListPartnerIdentificationsByPartner](../../../business-partner/docs/queries/ListPartnerIdentificationsByPartner.md) - Refresh supplier tax identification snapshot when draft bill data changes
32
+
33
+ ## Error Scenarios
34
+
35
+ - **PURCHASE_BILL_NOT_FOUND**: Target purchase bill does not exist
36
+ - **PURCHASE_BILL_NOT_DRAFT**: Purchase bill is not in `DRAFT` status
37
+ - **DUPLICATE_SUPPLIER_INVOICE_NUMBER**: Supplier invoice number already exists in the same company and supplier scope
38
+ - **PURCHASE_ORDER_LINE_NOT_FOUND**: Referenced purchase-order line does not exist
39
+ - **INVALID_BILLED_QUANTITY**: Billed quantity is zero or negative
40
+ - **PURCHASE_ORDER_CANCELLED**: Referenced purchase order is cancelled
41
+
42
+ ## Test Cases
43
+
44
+ - updates invoice metadata on a draft purchase bill
45
+ - updates bill lines on a draft purchase bill
46
+ - returns error when purchase bill does not exist
47
+ - returns error when purchase bill is not draft
48
+ - returns error when updated invoice number is duplicated
49
+ - returns error when updated line data is invalid
50
+ - returns error when updated billed quantity is zero or negative
51
+ - returns error when updated bill references a cancelled purchase order
@@ -0,0 +1,59 @@
1
+ # UpdatePurchaseOrder
2
+
3
+ ## Overview
4
+
5
+ UpdatePurchaseOrder revises mutable commercial data on a draft purchase order, including lines, supplier-facing price overrides, payment term selection, and receiving context.
6
+
7
+ ## Business Rules
8
+
9
+ - Target purchase order must exist
10
+ - Only orders in `DRAFT` status can be updated
11
+ - Updated lines must satisfy the same validation rules as create
12
+ - Draft buyers may override a defaulted supplier price while retaining the matched-rule reference for audit
13
+ - Updating a purchase order never changes already ordered, received, or billed documents
14
+
15
+ ## Process Flow
16
+
17
+ ```mermaid
18
+ flowchart TD
19
+ A[Receive update request] --> B{Purchase order exists?}
20
+ B -->|No| C[Return PURCHASE_ORDER_NOT_FOUND]
21
+ B -->|Yes| D{Status is DRAFT?}
22
+ D -->|No| E[Return PURCHASE_ORDER_NOT_DRAFT]
23
+ D -->|Yes| F{Updated lines and references valid?}
24
+ F -->|No| G[Return validation error]
25
+ F -->|Yes| H[Update draft order and lines]
26
+ H --> I[Return updated order]
27
+ ```
28
+
29
+ ## External Dependencies
30
+
31
+ - [business-partner::GetPartner](../../../business-partner/docs/queries/GetPartner.md) - Re-validate supplier identity and role when supplier-facing data changes
32
+ - [item-management::GetItem](../../../item-management/docs/queries/GetItem.md) - Re-validate item references on changed lines
33
+ - [organization::GetSite](../../../organization/docs/queries/GetSite.md) - Re-validate receiving site references
34
+
35
+ ## Error Scenarios
36
+
37
+ - **PURCHASE_ORDER_NOT_FOUND**: Target purchase order does not exist
38
+ - **PURCHASE_ORDER_NOT_DRAFT**: Purchase order is not in `DRAFT` status
39
+ - **ITEM_NOT_FOUND**: Referenced item does not exist
40
+ - **ITEM_NOT_ACTIVE**: Referenced item is inactive
41
+ - **INVALID_QUANTITY**: Ordered quantity is zero or negative
42
+ - **INVALID_UNIT_PRICE**: Unit price is negative
43
+ - **RECEIVING_SITE_NOT_FOUND**: Referenced receiving site does not exist
44
+ - **RECEIVING_SITE_REQUIRED**: A physical-receipt line has no receiving site
45
+ - **PAYMENT_TERM_INACTIVE**: Selected payment term is inactive for new draft use
46
+
47
+ ## Test Cases
48
+
49
+ - updates supplier-facing data on a draft purchase order
50
+ - updates line pricing while preserving matched price-rule reference
51
+ - returns error when purchase order does not exist
52
+ - returns error when purchase order is not in draft
53
+ - returns error when updated line data is invalid
54
+ - returns error when an updated line item is inactive
55
+ - returns error when an updated line quantity is not positive
56
+ - returns error when an updated line unit price is negative
57
+ - returns error when an updated receiving site does not exist
58
+ - returns error when a physical-receipt line has no receiving site
59
+ - returns error when selected payment term is inactive
@@ -0,0 +1,51 @@
1
+ # UpdatePurchasePaymentTerm
2
+
3
+ ## Overview
4
+
5
+ UpdatePurchasePaymentTerm changes the live definition of a purchase payment term without rewriting any historical snapshots already copied onto purchase orders or purchase bills.
6
+
7
+ ## Business Rules
8
+
9
+ - Target payment term must exist
10
+ - Updated schedule lines must continue to satisfy all create-time validation rules
11
+ - Existing purchase orders and purchase bills keep their original snapshots after the term is updated
12
+ - Updating an inactive term is allowed so it can be corrected before future reactivation
13
+ - Company ownership of the term cannot be changed
14
+
15
+ ## Process Flow
16
+
17
+ ```mermaid
18
+ flowchart TD
19
+ A[Receive update request] --> B{Payment term exists?}
20
+ B -->|No| C[Return PAYMENT_TERM_NOT_FOUND]
21
+ B -->|Yes| D{Schedule and discount data valid?}
22
+ D -->|No| E[Return validation error]
23
+ D -->|Yes| F[Update payment term and schedule lines]
24
+ F --> G[Return updated term]
25
+ ```
26
+
27
+ ## External Dependencies
28
+
29
+ - [organization::GetCompany](../../../organization/docs/queries/GetCompany.md) - Preserve and validate existing company scope
30
+
31
+ ## Error Scenarios
32
+
33
+ - **PAYMENT_TERM_NOT_FOUND**: Target payment term does not exist
34
+ - **EMPTY_SCHEDULE**: No payment term schedule lines were provided
35
+ - **INVALID_INSTALLMENT_TOTAL**: Percentage-based installment lines do not total 100 percent
36
+ - **INVALID_SCHEDULE_LINE**: A schedule line contains a negative amount or percentage
37
+ - **INVALID_DISCOUNT_CONFIGURATION**: Discount metadata is incomplete or inconsistent with the final due date
38
+ - **IMMUTABLE_COMPANY_SCOPE**: Update attempted to move the term into another company
39
+
40
+ ## Test Cases
41
+
42
+ - updates name and schedule lines on an active payment term
43
+ - updates an inactive payment term without reactivating it
44
+ - preserves historical purchase-order snapshots after update
45
+ - preserves historical purchase-bill snapshots after update
46
+ - returns error when payment term does not exist
47
+ - returns error when the updated schedule is empty
48
+ - returns error when updated schedule is invalid
49
+ - returns error when an updated schedule line is invalid
50
+ - returns error when an updated discount configuration is invalid
51
+ - returns error when company scope is changed
@@ -0,0 +1,43 @@
1
+ # UpdatePurchasePriceList
2
+
3
+ ## Overview
4
+
5
+ UpdatePurchasePriceList updates descriptive metadata, validity notes, or deterministic priority on an existing supplier price list without changing historical order snapshots.
6
+
7
+ ## Business Rules
8
+
9
+ - Target price list must exist
10
+ - Company and supplier ownership are immutable
11
+ - Updating a price list never rewrites purchase orders that already snapshotted one of its rules
12
+ - Priority changes must preserve deterministic ordering for rule selection
13
+
14
+ ## Process Flow
15
+
16
+ ```mermaid
17
+ flowchart TD
18
+ A[Receive update request] --> B{Price list exists?}
19
+ B -->|No| C[Return PRICE_LIST_NOT_FOUND]
20
+ B -->|Yes| D{Ownership unchanged and priority valid?}
21
+ D -->|No| E[Return validation error]
22
+ D -->|Yes| F[Update price list]
23
+ F --> G[Return updated list]
24
+ ```
25
+
26
+ ## External Dependencies
27
+
28
+ - None
29
+
30
+ ## Error Scenarios
31
+
32
+ - **PRICE_LIST_NOT_FOUND**: Target price list does not exist
33
+ - **IMMUTABLE_OWNER_CHANGE**: Update attempted to change the supplier or company owner
34
+ - **INVALID_LIST_PRIORITY**: Updated priority conflicts with deterministic rule ordering
35
+
36
+ ## Test Cases
37
+
38
+ - updates metadata on an active price list
39
+ - updates metadata on an inactive price list
40
+ - preserves historical purchase-order snapshots after update
41
+ - returns error when price list does not exist
42
+ - returns error when supplier or company ownership is changed
43
+ - returns error when updated priority is invalid
@@ -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)