shutro-erp 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (618) hide show
  1. package/dist/account_asset/.kosh/bindings.d.ts +22 -0
  2. package/dist/account_asset/.kosh/bindings.js +15 -0
  3. package/dist/account_asset/.kosh/schema.d.ts +1755 -0
  4. package/dist/account_asset/board.d.ts +61 -0
  5. package/dist/account_asset/board.js +86 -0
  6. package/dist/account_asset/books.d.ts +42 -0
  7. package/dist/account_asset/books.js +398 -0
  8. package/dist/account_asset/demo.d.ts +7 -0
  9. package/dist/account_asset/demo.js +72 -0
  10. package/dist/account_asset/index.d.ts +9 -0
  11. package/dist/account_asset/index.js +335 -0
  12. package/dist/account_asset/module.d.ts +7622 -0
  13. package/dist/account_asset/module.js +230 -0
  14. package/dist/account_budget/.kosh/bindings.d.ts +22 -0
  15. package/dist/account_budget/.kosh/bindings.js +15 -0
  16. package/dist/account_budget/.kosh/schema.d.ts +1767 -0
  17. package/dist/account_budget/budget.d.ts +5 -0
  18. package/dist/account_budget/budget.js +142 -0
  19. package/dist/account_budget/demo.d.ts +6 -0
  20. package/dist/account_budget/demo.js +30 -0
  21. package/dist/account_budget/index.d.ts +4 -0
  22. package/dist/account_budget/index.js +223 -0
  23. package/dist/account_budget/module.d.ts +13863 -0
  24. package/dist/account_budget/module.js +167 -0
  25. package/dist/account_portal/.kosh/bindings.js +1 -1
  26. package/dist/account_portal/.kosh/schema.d.ts +176 -6
  27. package/dist/account_portal/module.d.ts +505 -6
  28. package/dist/accounting/.kosh/bindings.js +1 -1
  29. package/dist/accounting/.kosh/schema.d.ts +176 -6
  30. package/dist/accounting/index.d.ts +1 -1
  31. package/dist/accounting/index.js +344 -4
  32. package/dist/accounting/module.d.ts +513 -5
  33. package/dist/accounting/module.js +55 -3
  34. package/dist/approvals/.kosh/bindings.d.ts +22 -0
  35. package/dist/approvals/.kosh/bindings.js +15 -0
  36. package/dist/approvals/.kosh/schema.d.ts +611 -0
  37. package/dist/approvals/index.d.ts +18 -0
  38. package/dist/approvals/index.js +302 -0
  39. package/dist/approvals/mails.d.ts +25 -0
  40. package/dist/approvals/mails.js +82 -0
  41. package/dist/approvals/module.d.ts +1 -0
  42. package/dist/approvals/module.js +12 -0
  43. package/dist/approvals/web/History.d.ts +4 -0
  44. package/dist/approvals/web/History.js +13 -0
  45. package/dist/approvals/web/Inbox.d.ts +9 -0
  46. package/dist/approvals/web/Inbox.js +114 -0
  47. package/dist/approvals/web/Mine.d.ts +7 -0
  48. package/dist/approvals/web/Mine.js +27 -0
  49. package/dist/approvals/web/index.d.ts +13 -0
  50. package/dist/approvals/web/index.js +22 -0
  51. package/dist/approvals/web/messages.d.ts +2 -0
  52. package/dist/approvals/web/messages.js +119 -0
  53. package/dist/approvals/web/shared.d.ts +59 -0
  54. package/dist/approvals/web/shared.js +46 -0
  55. package/dist/attendance/.kosh/bindings.d.ts +22 -0
  56. package/dist/attendance/.kosh/bindings.js +15 -0
  57. package/dist/attendance/.kosh/schema.d.ts +1048 -0
  58. package/dist/attendance/days.d.ts +96 -0
  59. package/dist/attendance/days.js +430 -0
  60. package/dist/attendance/demo.d.ts +7 -0
  61. package/dist/attendance/demo.js +58 -0
  62. package/dist/attendance/index.d.ts +4 -0
  63. package/dist/attendance/index.js +513 -0
  64. package/dist/attendance/module.d.ts +3969 -0
  65. package/dist/attendance/module.js +412 -0
  66. package/dist/attendance/routes.d.ts +16 -0
  67. package/dist/attendance/routes.js +266 -0
  68. package/dist/attendance/web/Check.d.ts +8 -0
  69. package/dist/attendance/web/Check.js +40 -0
  70. package/dist/attendance/web/Kiosk.d.ts +8 -0
  71. package/dist/attendance/web/Kiosk.js +62 -0
  72. package/dist/attendance/web/PinButton.d.ts +7 -0
  73. package/dist/attendance/web/PinButton.js +29 -0
  74. package/dist/attendance/web/index.d.ts +13 -0
  75. package/dist/attendance/web/index.js +22 -0
  76. package/dist/attendance/web/messages.d.ts +2 -0
  77. package/dist/attendance/web/messages.js +61 -0
  78. package/dist/calendar/.kosh/bindings.d.ts +22 -0
  79. package/dist/calendar/.kosh/bindings.js +15 -0
  80. package/dist/calendar/.kosh/schema.d.ts +795 -0
  81. package/dist/calendar/demo.d.ts +6 -0
  82. package/dist/calendar/demo.js +24 -0
  83. package/dist/calendar/index.d.ts +3 -0
  84. package/dist/calendar/index.js +291 -0
  85. package/dist/calendar/module.d.ts +1705 -0
  86. package/dist/calendar/module.js +180 -0
  87. package/dist/cli/init.js +80 -0
  88. package/dist/cli/templates.d.ts +1 -1
  89. package/dist/cli/templates.js +226 -0
  90. package/dist/contacts/.kosh/bindings.js +1 -1
  91. package/dist/contacts/.kosh/schema.d.ts +78 -3
  92. package/dist/contacts/demo.js +30 -1
  93. package/dist/contacts/index.d.ts +1 -1
  94. package/dist/contacts/index.js +155 -9
  95. package/dist/contacts/module.d.ts +338 -2
  96. package/dist/contacts/module.js +93 -5
  97. package/dist/crm/.kosh/bindings.d.ts +22 -0
  98. package/dist/crm/.kosh/bindings.js +15 -0
  99. package/dist/crm/.kosh/schema.d.ts +800 -0
  100. package/dist/crm/demo.d.ts +6 -0
  101. package/dist/crm/demo.js +45 -0
  102. package/dist/crm/index.d.ts +3 -0
  103. package/dist/crm/index.js +361 -0
  104. package/dist/crm/module.d.ts +1845 -0
  105. package/dist/crm/module.js +208 -0
  106. package/dist/documents/.kosh/bindings.d.ts +22 -0
  107. package/dist/documents/.kosh/bindings.js +15 -0
  108. package/dist/documents/.kosh/schema.d.ts +862 -0
  109. package/dist/documents/demo.d.ts +6 -0
  110. package/dist/documents/demo.js +22 -0
  111. package/dist/documents/documents.d.ts +98 -0
  112. package/dist/documents/documents.js +318 -0
  113. package/dist/documents/index.d.ts +30 -0
  114. package/dist/documents/index.js +442 -0
  115. package/dist/documents/module.d.ts +2781 -0
  116. package/dist/documents/module.js +214 -0
  117. package/dist/documents/web/Versions.d.ts +7 -0
  118. package/dist/documents/web/Versions.js +45 -0
  119. package/dist/documents/web/index.d.ts +11 -0
  120. package/dist/documents/web/index.js +16 -0
  121. package/dist/documents/web/messages.d.ts +2 -0
  122. package/dist/documents/web/messages.js +21 -0
  123. package/dist/event/.kosh/bindings.d.ts +22 -0
  124. package/dist/event/.kosh/bindings.js +15 -0
  125. package/dist/event/.kosh/schema.d.ts +843 -0
  126. package/dist/event/demo.d.ts +6 -0
  127. package/dist/event/demo.js +65 -0
  128. package/dist/event/index.d.ts +14 -0
  129. package/dist/event/index.js +333 -0
  130. package/dist/event/mails.d.ts +15 -0
  131. package/dist/event/mails.js +112 -0
  132. package/dist/event/module.d.ts +2800 -0
  133. package/dist/event/module.js +323 -0
  134. package/dist/event/web/CheckInBox.d.ts +9 -0
  135. package/dist/event/web/CheckInBox.js +87 -0
  136. package/dist/event/web/index.d.ts +11 -0
  137. package/dist/event/web/index.js +16 -0
  138. package/dist/event/web/messages.d.ts +2 -0
  139. package/dist/event/web/messages.js +23 -0
  140. package/dist/event_account/.kosh/bindings.d.ts +22 -0
  141. package/dist/event_account/.kosh/bindings.js +15 -0
  142. package/dist/event_account/.kosh/schema.d.ts +1758 -0
  143. package/dist/event_account/index.d.ts +3 -0
  144. package/dist/event_account/index.js +28 -0
  145. package/dist/event_account/module.d.ts +7114 -0
  146. package/dist/event_account/module.js +90 -0
  147. package/dist/expense/.kosh/bindings.d.ts +22 -0
  148. package/dist/expense/.kosh/bindings.js +15 -0
  149. package/dist/expense/.kosh/schema.d.ts +1299 -0
  150. package/dist/expense/demo.d.ts +7 -0
  151. package/dist/expense/demo.js +69 -0
  152. package/dist/expense/index.d.ts +3 -0
  153. package/dist/expense/index.js +495 -0
  154. package/dist/expense/module.d.ts +4747 -0
  155. package/dist/expense/module.js +647 -0
  156. package/dist/expense_account/.kosh/bindings.d.ts +22 -0
  157. package/dist/expense_account/.kosh/bindings.js +15 -0
  158. package/dist/expense_account/.kosh/schema.d.ts +1936 -0
  159. package/dist/expense_account/index.d.ts +3 -0
  160. package/dist/expense_account/index.js +74 -0
  161. package/dist/expense_account/module.d.ts +9153 -0
  162. package/dist/expense_account/module.js +318 -0
  163. package/dist/helpdesk/.kosh/bindings.d.ts +22 -0
  164. package/dist/helpdesk/.kosh/bindings.js +15 -0
  165. package/dist/helpdesk/.kosh/schema.d.ts +885 -0
  166. package/dist/helpdesk/demo.d.ts +7 -0
  167. package/dist/helpdesk/demo.js +65 -0
  168. package/dist/helpdesk/hours.d.ts +17 -0
  169. package/dist/helpdesk/hours.js +94 -0
  170. package/dist/helpdesk/index.d.ts +10 -0
  171. package/dist/helpdesk/index.js +461 -0
  172. package/dist/helpdesk/module.d.ts +2940 -0
  173. package/dist/helpdesk/module.js +326 -0
  174. package/dist/helpdesk/routes.d.ts +12 -0
  175. package/dist/helpdesk/routes.js +132 -0
  176. package/dist/helpdesk/sla.d.ts +37 -0
  177. package/dist/helpdesk/sla.js +226 -0
  178. package/dist/hr/.kosh/bindings.d.ts +22 -0
  179. package/dist/hr/.kosh/bindings.js +15 -0
  180. package/dist/hr/.kosh/schema.d.ts +878 -0
  181. package/dist/hr/demo.d.ts +6 -0
  182. package/dist/hr/demo.js +60 -0
  183. package/dist/hr/index.d.ts +3 -0
  184. package/dist/hr/index.js +483 -0
  185. package/dist/hr/module.d.ts +2611 -0
  186. package/dist/hr/module.js +350 -0
  187. package/dist/l10n_bd/.kosh/bindings.js +1 -1
  188. package/dist/l10n_bd/.kosh/schema.d.ts +176 -6
  189. package/dist/l10n_bd/module.d.ts +505 -6
  190. package/dist/l10n_bd_payroll/.kosh/bindings.d.ts +22 -0
  191. package/dist/l10n_bd_payroll/.kosh/bindings.js +15 -0
  192. package/dist/l10n_bd_payroll/.kosh/schema.d.ts +2312 -0
  193. package/dist/l10n_bd_payroll/data.d.ts +47 -0
  194. package/dist/l10n_bd_payroll/data.js +347 -0
  195. package/dist/l10n_bd_payroll/index.d.ts +4 -0
  196. package/dist/l10n_bd_payroll/index.js +24 -0
  197. package/dist/l10n_bd_payroll/module.d.ts +12932 -0
  198. package/dist/l10n_bd_payroll/module.js +86 -0
  199. package/dist/l10n_in/.kosh/bindings.js +1 -1
  200. package/dist/l10n_in/.kosh/schema.d.ts +176 -6
  201. package/dist/l10n_in/module.d.ts +527 -7
  202. package/dist/mail/inbound/handle.js +6 -1
  203. package/dist/maintenance/.kosh/bindings.d.ts +22 -0
  204. package/dist/maintenance/.kosh/bindings.js +15 -0
  205. package/dist/maintenance/.kosh/schema.d.ts +911 -0
  206. package/dist/maintenance/demo.d.ts +6 -0
  207. package/dist/maintenance/demo.js +60 -0
  208. package/dist/maintenance/index.d.ts +3 -0
  209. package/dist/maintenance/index.js +422 -0
  210. package/dist/maintenance/module.d.ts +3545 -0
  211. package/dist/maintenance/module.js +446 -0
  212. package/dist/maintenance_stock/.kosh/bindings.d.ts +22 -0
  213. package/dist/maintenance_stock/.kosh/bindings.js +15 -0
  214. package/dist/maintenance_stock/.kosh/schema.d.ts +1446 -0
  215. package/dist/maintenance_stock/index.d.ts +9 -0
  216. package/dist/maintenance_stock/index.js +52 -0
  217. package/dist/maintenance_stock/module.d.ts +7675 -0
  218. package/dist/maintenance_stock/module.js +192 -0
  219. package/dist/modules-sdk/index.d.ts +1 -1
  220. package/dist/modules-sdk/manifest.d.ts +109 -2
  221. package/dist/modules-sdk/manifest.js +35 -1
  222. package/dist/mrp/.kosh/bindings.d.ts +22 -0
  223. package/dist/mrp/.kosh/bindings.js +15 -0
  224. package/dist/mrp/.kosh/schema.d.ts +1453 -0
  225. package/dist/mrp/demo.d.ts +7 -0
  226. package/dist/mrp/demo.js +42 -0
  227. package/dist/mrp/index.d.ts +3 -0
  228. package/dist/mrp/index.js +393 -0
  229. package/dist/mrp/module.d.ts +9335 -0
  230. package/dist/mrp/module.js +757 -0
  231. package/dist/mrp_account/.kosh/bindings.d.ts +22 -0
  232. package/dist/mrp_account/.kosh/bindings.js +15 -0
  233. package/dist/mrp_account/.kosh/schema.d.ts +2299 -0
  234. package/dist/mrp_account/index.d.ts +3 -0
  235. package/dist/mrp_account/index.js +22 -0
  236. package/dist/mrp_account/module.d.ts +23151 -0
  237. package/dist/mrp_account/module.js +123 -0
  238. package/dist/payment/.kosh/bindings.js +1 -1
  239. package/dist/payment/.kosh/schema.d.ts +178 -7
  240. package/dist/payment/index.d.ts +41 -0
  241. package/dist/payment/index.js +131 -74
  242. package/dist/payment/module.d.ts +569 -12
  243. package/dist/payment/module.js +19 -3
  244. package/dist/payment/settle.js +10 -1
  245. package/dist/payroll/.kosh/bindings.d.ts +22 -0
  246. package/dist/payroll/.kosh/bindings.js +15 -0
  247. package/dist/payroll/.kosh/schema.d.ts +1390 -0
  248. package/dist/payroll/compute.d.ts +35 -0
  249. package/dist/payroll/compute.js +398 -0
  250. package/dist/payroll/demo.d.ts +55 -0
  251. package/dist/payroll/demo.js +121 -0
  252. package/dist/payroll/formula.d.ts +62 -0
  253. package/dist/payroll/formula.js +320 -0
  254. package/dist/payroll/index.d.ts +230 -0
  255. package/dist/payroll/index.js +713 -0
  256. package/dist/payroll/module.d.ts +9390 -0
  257. package/dist/payroll/module.js +606 -0
  258. package/dist/payroll/routes.d.ts +10 -0
  259. package/dist/payroll/routes.js +112 -0
  260. package/dist/payroll_account/.kosh/bindings.d.ts +22 -0
  261. package/dist/payroll_account/.kosh/bindings.js +15 -0
  262. package/dist/payroll_account/.kosh/schema.d.ts +2308 -0
  263. package/dist/payroll_account/index.d.ts +3 -0
  264. package/dist/payroll_account/index.js +40 -0
  265. package/dist/payroll_account/module.d.ts +12396 -0
  266. package/dist/payroll_account/module.js +256 -0
  267. package/dist/permissions/approvals.d.ts +131 -9
  268. package/dist/permissions/approvals.js +662 -57
  269. package/dist/permissions/index.d.ts +1 -1
  270. package/dist/permissions/index.js +2 -2
  271. package/dist/permissions/models.js +191 -12
  272. package/dist/permissions/routes.d.ts +6 -1
  273. package/dist/permissions/routes.js +37 -4
  274. package/dist/permissions/web/ApprovalPanel.d.ts +5 -4
  275. package/dist/permissions/web/ApprovalPanel.js +39 -13
  276. package/dist/permissions/web/index.d.ts +6 -4
  277. package/dist/permissions/web/index.js +13 -4
  278. package/dist/permissions/web/messages.d.ts +2 -0
  279. package/dist/permissions/web/messages.js +43 -0
  280. package/dist/portal/.kosh/bindings.js +1 -1
  281. package/dist/portal/.kosh/schema.d.ts +78 -3
  282. package/dist/portal/index.js +1 -1
  283. package/dist/portal/module.d.ts +166 -2
  284. package/dist/pos/.kosh/bindings.d.ts +22 -0
  285. package/dist/pos/.kosh/bindings.js +15 -0
  286. package/dist/pos/.kosh/schema.d.ts +1809 -0
  287. package/dist/pos/accounting.d.ts +10 -0
  288. package/dist/pos/accounting.js +149 -0
  289. package/dist/pos/demo.d.ts +6 -0
  290. package/dist/pos/demo.js +90 -0
  291. package/dist/pos/index.d.ts +9 -0
  292. package/dist/pos/index.js +353 -0
  293. package/dist/pos/module.d.ts +9783 -0
  294. package/dist/pos/module.js +423 -0
  295. package/dist/pos/routes.d.ts +39 -0
  296. package/dist/pos/routes.js +368 -0
  297. package/dist/pos/web/Register.d.ts +9 -0
  298. package/dist/pos/web/Register.js +252 -0
  299. package/dist/pos/web/index.d.ts +11 -0
  300. package/dist/pos/web/index.js +16 -0
  301. package/dist/pos/web/messages.d.ts +2 -0
  302. package/dist/pos/web/messages.js +87 -0
  303. package/dist/pos_stock/.kosh/bindings.d.ts +22 -0
  304. package/dist/pos_stock/.kosh/bindings.js +15 -0
  305. package/dist/pos_stock/.kosh/schema.d.ts +2208 -0
  306. package/dist/pos_stock/index.d.ts +9 -0
  307. package/dist/pos_stock/index.js +35 -0
  308. package/dist/pos_stock/module.d.ts +12803 -0
  309. package/dist/pos_stock/module.js +115 -0
  310. package/dist/product/.kosh/bindings.js +1 -1
  311. package/dist/product/.kosh/schema.d.ts +52 -1
  312. package/dist/product/index.js +94 -4
  313. package/dist/product/module.d.ts +45 -1
  314. package/dist/product/module.js +11 -3
  315. package/dist/project/.kosh/bindings.js +1 -1
  316. package/dist/project/.kosh/schema.d.ts +725 -3
  317. package/dist/project/index.d.ts +3 -1
  318. package/dist/project/index.js +1045 -18
  319. package/dist/project/module.d.ts +10168 -458
  320. package/dist/project/module.js +1578 -14
  321. package/dist/project/routes.d.ts +44 -0
  322. package/dist/project/routes.js +314 -0
  323. package/dist/project/schedule.d.ts +72 -0
  324. package/dist/project/schedule.js +192 -0
  325. package/dist/project/web/Refresh.d.ts +8 -0
  326. package/dist/project/web/Refresh.js +29 -0
  327. package/dist/project/web/Schedule.d.ts +9 -0
  328. package/dist/project/web/Schedule.js +93 -0
  329. package/dist/project/web/Structure.d.ts +8 -0
  330. package/dist/project/web/Structure.js +86 -0
  331. package/dist/project/web/Workload.d.ts +8 -0
  332. package/dist/project/web/Workload.js +43 -0
  333. package/dist/project/web/index.d.ts +14 -0
  334. package/dist/project/web/index.js +25 -0
  335. package/dist/project/web/messages.d.ts +2 -0
  336. package/dist/project/web/messages.js +85 -0
  337. package/dist/project_account/.kosh/bindings.d.ts +22 -0
  338. package/dist/project_account/.kosh/bindings.js +15 -0
  339. package/dist/project_account/.kosh/schema.d.ts +2241 -0
  340. package/dist/project_account/index.d.ts +3 -0
  341. package/dist/project_account/index.js +27 -0
  342. package/dist/project_account/module.d.ts +11539 -0
  343. package/dist/project_account/module.js +76 -0
  344. package/dist/project_portal/.kosh/bindings.js +1 -1
  345. package/dist/project_portal/.kosh/schema.d.ts +725 -3
  346. package/dist/project_portal/module.d.ts +5137 -119
  347. package/dist/project_purchase/.kosh/bindings.d.ts +22 -0
  348. package/dist/project_purchase/.kosh/bindings.js +15 -0
  349. package/dist/project_purchase/.kosh/schema.d.ts +2320 -0
  350. package/dist/project_purchase/index.d.ts +9 -0
  351. package/dist/project_purchase/index.js +22 -0
  352. package/dist/project_purchase/module.d.ts +25147 -0
  353. package/dist/project_purchase/module.js +56 -0
  354. package/dist/purchase/.kosh/bindings.js +1 -1
  355. package/dist/purchase/.kosh/schema.d.ts +150 -6
  356. package/dist/purchase/index.js +163 -3
  357. package/dist/purchase/module.d.ts +228 -5
  358. package/dist/purchase/module.js +30 -3
  359. package/dist/purchase_account/.kosh/bindings.js +1 -1
  360. package/dist/purchase_account/.kosh/schema.d.ts +180 -8
  361. package/dist/purchase_account/index.js +27 -1
  362. package/dist/purchase_account/module.d.ts +591 -30
  363. package/dist/purchase_account/module.js +13 -2
  364. package/dist/purchase_portal/.kosh/bindings.js +1 -1
  365. package/dist/purchase_portal/.kosh/schema.d.ts +150 -6
  366. package/dist/purchase_portal/module.d.ts +372 -6
  367. package/dist/purchase_stock/.kosh/bindings.d.ts +22 -0
  368. package/dist/purchase_stock/.kosh/bindings.js +15 -0
  369. package/dist/purchase_stock/.kosh/schema.d.ts +1479 -0
  370. package/dist/purchase_stock/index.d.ts +7 -0
  371. package/dist/purchase_stock/index.js +98 -0
  372. package/dist/purchase_stock/module.d.ts +7535 -0
  373. package/dist/purchase_stock/module.js +380 -0
  374. package/dist/purchase_stock_account/.kosh/bindings.d.ts +22 -0
  375. package/dist/purchase_stock_account/.kosh/bindings.js +15 -0
  376. package/dist/purchase_stock_account/.kosh/schema.d.ts +2155 -0
  377. package/dist/purchase_stock_account/index.d.ts +3 -0
  378. package/dist/purchase_stock_account/index.js +24 -0
  379. package/dist/purchase_stock_account/module.d.ts +38015 -0
  380. package/dist/purchase_stock_account/module.js +168 -0
  381. package/dist/recruitment/.kosh/bindings.d.ts +22 -0
  382. package/dist/recruitment/.kosh/bindings.js +15 -0
  383. package/dist/recruitment/.kosh/schema.d.ts +991 -0
  384. package/dist/recruitment/demo.d.ts +6 -0
  385. package/dist/recruitment/demo.js +45 -0
  386. package/dist/recruitment/index.d.ts +3 -0
  387. package/dist/recruitment/index.js +385 -0
  388. package/dist/recruitment/module.d.ts +3249 -0
  389. package/dist/recruitment/module.js +194 -0
  390. package/dist/recruitment/web/HireButton.d.ts +9 -0
  391. package/dist/recruitment/web/HireButton.js +32 -0
  392. package/dist/recruitment/web/index.d.ts +11 -0
  393. package/dist/recruitment/web/index.js +16 -0
  394. package/dist/recruitment/web/messages.d.ts +2 -0
  395. package/dist/recruitment/web/messages.js +19 -0
  396. package/dist/reporting/documents.d.ts +5 -0
  397. package/dist/reporting/documents.js +28 -1
  398. package/dist/reporting/index.d.ts +1 -1
  399. package/dist/reporting/index.js +4 -2
  400. package/dist/reporting/models.js +9 -0
  401. package/dist/reporting/overviews.d.ts +16 -0
  402. package/dist/reporting/overviews.js +56 -0
  403. package/dist/reporting/routes-documents.js +1 -1
  404. package/dist/reporting/routes.js +138 -80
  405. package/dist/reporting/web/DashboardView.d.ts +11 -0
  406. package/dist/reporting/web/DashboardView.js +2 -2
  407. package/dist/reporting/web/DesignerView.js +5 -0
  408. package/dist/reporting/web/Overview.d.ts +9 -0
  409. package/dist/reporting/web/Overview.js +53 -0
  410. package/dist/reporting/web/index.d.ts +1 -0
  411. package/dist/reporting/web/index.js +4 -1
  412. package/dist/reporting/web/messages.js +9 -0
  413. package/dist/sale_account/.kosh/bindings.js +1 -1
  414. package/dist/sale_account/.kosh/schema.d.ts +181 -6
  415. package/dist/sale_account/index.js +22 -1
  416. package/dist/sale_account/module.d.ts +639 -38
  417. package/dist/sale_portal/.kosh/bindings.js +1 -1
  418. package/dist/sale_portal/.kosh/schema.d.ts +59 -3
  419. package/dist/sale_portal/module.d.ts +435 -5
  420. package/dist/sale_project/.kosh/bindings.js +1 -1
  421. package/dist/sale_project/.kosh/schema.d.ts +732 -3
  422. package/dist/sale_project/module.d.ts +5349 -208
  423. package/dist/sale_project/module.js +17 -1
  424. package/dist/sale_stock/.kosh/bindings.d.ts +22 -0
  425. package/dist/sale_stock/.kosh/bindings.js +15 -0
  426. package/dist/sale_stock/.kosh/schema.d.ts +1303 -0
  427. package/dist/sale_stock/index.d.ts +7 -0
  428. package/dist/sale_stock/index.js +84 -0
  429. package/dist/sale_stock/module.d.ts +7514 -0
  430. package/dist/sale_stock/module.js +146 -0
  431. package/dist/sales/.kosh/bindings.js +1 -1
  432. package/dist/sales/.kosh/schema.d.ts +59 -3
  433. package/dist/sales/index.js +195 -4
  434. package/dist/sales/module.d.ts +356 -3
  435. package/dist/sales/module.js +78 -3
  436. package/dist/server/api/metadata.d.ts +5 -0
  437. package/dist/server/api/metadata.js +5 -0
  438. package/dist/server/api/rest.js +64 -1
  439. package/dist/server/api/views.js +1 -0
  440. package/dist/server/app-settings.d.ts +7 -0
  441. package/dist/server/app-settings.js +10 -0
  442. package/dist/server/auth/base.js +9 -0
  443. package/dist/server/index.d.ts +1 -0
  444. package/dist/server/index.js +1 -0
  445. package/dist/settings/app-settings.d.ts +2 -0
  446. package/dist/settings/app-settings.js +518 -0
  447. package/dist/settings/index.d.ts +1 -0
  448. package/dist/settings/index.js +15 -0
  449. package/dist/settings/people.js +29 -5
  450. package/dist/settings/web/AppSettingsPage.d.ts +11 -0
  451. package/dist/settings/web/AppSettingsPage.js +210 -0
  452. package/dist/settings/web/OverviewPage.js +16 -3
  453. package/dist/settings/web/PeoplePage.js +20 -6
  454. package/dist/settings/web/index.d.ts +1 -0
  455. package/dist/settings/web/index.js +3 -0
  456. package/dist/settings/web/messages.js +118 -2
  457. package/dist/sign/.kosh/bindings.d.ts +22 -0
  458. package/dist/sign/.kosh/bindings.js +15 -0
  459. package/dist/sign/.kosh/schema.d.ts +990 -0
  460. package/dist/sign/index.d.ts +14 -0
  461. package/dist/sign/index.js +350 -0
  462. package/dist/sign/module.d.ts +4478 -0
  463. package/dist/sign/module.js +158 -0
  464. package/dist/sign/sign.d.ts +82 -0
  465. package/dist/sign/sign.js +474 -0
  466. package/dist/stock/.kosh/bindings.d.ts +22 -0
  467. package/dist/stock/.kosh/bindings.js +15 -0
  468. package/dist/stock/.kosh/schema.d.ts +1222 -0
  469. package/dist/stock/demo.d.ts +8 -0
  470. package/dist/stock/demo.js +82 -0
  471. package/dist/stock/index.d.ts +4 -0
  472. package/dist/stock/index.js +903 -0
  473. package/dist/stock/module.d.ts +7856 -0
  474. package/dist/stock/module.js +1880 -0
  475. package/dist/stock/replenish.d.ts +38 -0
  476. package/dist/stock/replenish.js +176 -0
  477. package/dist/stock/web/Replenishment.d.ts +8 -0
  478. package/dist/stock/web/Replenishment.js +84 -0
  479. package/dist/stock/web/ScanBox.d.ts +8 -0
  480. package/dist/stock/web/ScanBox.js +90 -0
  481. package/dist/stock/web/index.d.ts +13 -0
  482. package/dist/stock/web/index.js +20 -0
  483. package/dist/stock/web/messages.d.ts +2 -0
  484. package/dist/stock/web/messages.js +77 -0
  485. package/dist/stock_account/.kosh/bindings.d.ts +22 -0
  486. package/dist/stock_account/.kosh/bindings.js +15 -0
  487. package/dist/stock_account/.kosh/schema.d.ts +2068 -0
  488. package/dist/stock_account/index.d.ts +3 -0
  489. package/dist/stock_account/index.js +140 -0
  490. package/dist/stock_account/module.d.ts +11523 -0
  491. package/dist/stock_account/module.js +339 -0
  492. package/dist/storage/attachments.d.ts +5 -0
  493. package/dist/storage/attachments.js +12 -1
  494. package/dist/storage/models.js +3 -0
  495. package/dist/storage/routes.js +13 -2
  496. package/dist/todo/.kosh/bindings.d.ts +22 -0
  497. package/dist/todo/.kosh/bindings.js +15 -0
  498. package/dist/todo/.kosh/schema.d.ts +732 -0
  499. package/dist/todo/demo.d.ts +6 -0
  500. package/dist/todo/demo.js +35 -0
  501. package/dist/todo/index.d.ts +3 -0
  502. package/dist/todo/index.js +187 -0
  503. package/dist/todo/module.d.ts +1180 -0
  504. package/dist/todo/module.js +130 -0
  505. package/dist/trade_finance/.kosh/bindings.d.ts +22 -0
  506. package/dist/trade_finance/.kosh/bindings.js +15 -0
  507. package/dist/trade_finance/.kosh/schema.d.ts +884 -0
  508. package/dist/trade_finance/demo.d.ts +6 -0
  509. package/dist/trade_finance/demo.js +63 -0
  510. package/dist/trade_finance/index.d.ts +3 -0
  511. package/dist/trade_finance/index.js +415 -0
  512. package/dist/trade_finance/module.d.ts +3779 -0
  513. package/dist/trade_finance/module.js +507 -0
  514. package/dist/trade_finance_account/.kosh/bindings.d.ts +22 -0
  515. package/dist/trade_finance_account/.kosh/bindings.js +15 -0
  516. package/dist/trade_finance_account/.kosh/schema.d.ts +1830 -0
  517. package/dist/trade_finance_account/index.d.ts +3 -0
  518. package/dist/trade_finance_account/index.js +93 -0
  519. package/dist/trade_finance_account/module.d.ts +8074 -0
  520. package/dist/trade_finance_account/module.js +245 -0
  521. package/dist/trade_finance_purchase/.kosh/bindings.d.ts +22 -0
  522. package/dist/trade_finance_purchase/.kosh/bindings.js +15 -0
  523. package/dist/trade_finance_purchase/.kosh/schema.d.ts +1246 -0
  524. package/dist/trade_finance_purchase/index.d.ts +8 -0
  525. package/dist/trade_finance_purchase/index.js +50 -0
  526. package/dist/trade_finance_purchase/module.d.ts +4257 -0
  527. package/dist/trade_finance_purchase/module.js +44 -0
  528. package/dist/trade_finance_sale/.kosh/bindings.d.ts +22 -0
  529. package/dist/trade_finance_sale/.kosh/bindings.js +15 -0
  530. package/dist/trade_finance_sale/.kosh/schema.d.ts +1072 -0
  531. package/dist/trade_finance_sale/index.d.ts +8 -0
  532. package/dist/trade_finance_sale/index.js +50 -0
  533. package/dist/trade_finance_sale/module.d.ts +4281 -0
  534. package/dist/trade_finance_sale/module.js +44 -0
  535. package/dist/ui/api.d.ts +2 -1
  536. package/dist/ui/api.js +2 -1
  537. package/dist/ui/app.js +26 -13
  538. package/dist/ui/components/AppIcon.js +30 -1
  539. package/dist/ui/components/primitives.d.ts +2 -0
  540. package/dist/ui/components/primitives.js +7 -1
  541. package/dist/ui/i18n/messages.d.ts +27 -0
  542. package/dist/ui/i18n/messages.js +46 -0
  543. package/dist/ui/index.d.ts +1 -0
  544. package/dist/ui/index.js +1 -0
  545. package/dist/ui/offline/queue.d.ts +5 -1
  546. package/dist/ui/offline/queue.js +2 -0
  547. package/dist/ui/registry.d.ts +5 -0
  548. package/dist/ui/shell/Home.js +55 -4
  549. package/dist/ui/views/FormView.js +102 -19
  550. package/dist/ui/views/KanbanView.d.ts +2 -0
  551. package/dist/ui/views/KanbanView.js +40 -3
  552. package/dist/ui/views/ListView.js +110 -11
  553. package/dist/ui/views/StatsRow.d.ts +14 -0
  554. package/dist/ui/views/StatsRow.js +88 -0
  555. package/dist/ui/views/widgets.d.ts +2 -1
  556. package/dist/ui/views/widgets.js +200 -1
  557. package/dist/views/builders.d.ts +19 -2
  558. package/dist/views/builders.js +21 -1
  559. package/dist/views/condition.d.ts +6 -0
  560. package/dist/views/condition.js +20 -0
  561. package/dist/views/documents.d.ts +8 -0
  562. package/dist/views/extend.d.ts +2 -2
  563. package/dist/views/extend.js +11 -1
  564. package/dist/views/index.d.ts +2 -2
  565. package/dist/views/index.js +2 -2
  566. package/dist/views/types.d.ts +52 -5
  567. package/dist/views/validate.js +39 -1
  568. package/dist/website/.kosh/bindings.d.ts +22 -0
  569. package/dist/website/.kosh/bindings.js +15 -0
  570. package/dist/website/.kosh/schema.d.ts +881 -0
  571. package/dist/website/demo.d.ts +6 -0
  572. package/dist/website/demo.js +115 -0
  573. package/dist/website/index.d.ts +9 -0
  574. package/dist/website/index.js +251 -0
  575. package/dist/website/module.d.ts +2987 -0
  576. package/dist/website/module.js +282 -0
  577. package/dist/website/render.d.ts +45 -0
  578. package/dist/website/render.js +102 -0
  579. package/dist/website/routes.d.ts +12 -0
  580. package/dist/website/routes.js +246 -0
  581. package/dist/website/web/PagePreview.d.ts +7 -0
  582. package/dist/website/web/PagePreview.js +33 -0
  583. package/dist/website/web/index.d.ts +11 -0
  584. package/dist/website/web/index.js +16 -0
  585. package/dist/website/web/messages.d.ts +2 -0
  586. package/dist/website/web/messages.js +15 -0
  587. package/dist/website_crm/.kosh/bindings.d.ts +22 -0
  588. package/dist/website_crm/.kosh/bindings.js +15 -0
  589. package/dist/website_crm/.kosh/schema.d.ts +967 -0
  590. package/dist/website_crm/index.d.ts +3 -0
  591. package/dist/website_crm/index.js +39 -0
  592. package/dist/website_crm/module.d.ts +2956 -0
  593. package/dist/website_crm/module.js +44 -0
  594. package/dist/website_sale/.kosh/bindings.d.ts +22 -0
  595. package/dist/website_sale/.kosh/bindings.js +15 -0
  596. package/dist/website_sale/.kosh/schema.d.ts +2284 -0
  597. package/dist/website_sale/couriers.d.ts +50 -0
  598. package/dist/website_sale/couriers.js +59 -0
  599. package/dist/website_sale/demo.d.ts +7 -0
  600. package/dist/website_sale/demo.js +90 -0
  601. package/dist/website_sale/growth.d.ts +31 -0
  602. package/dist/website_sale/growth.js +163 -0
  603. package/dist/website_sale/index.d.ts +49 -0
  604. package/dist/website_sale/index.js +538 -0
  605. package/dist/website_sale/module.d.ts +22027 -0
  606. package/dist/website_sale/module.js +397 -0
  607. package/dist/website_sale/shipments.d.ts +16 -0
  608. package/dist/website_sale/shipments.js +113 -0
  609. package/dist/website_sale/shop.d.ts +81 -0
  610. package/dist/website_sale/shop.js +649 -0
  611. package/dist/website_sale_stock/.kosh/bindings.d.ts +22 -0
  612. package/dist/website_sale_stock/.kosh/bindings.js +15 -0
  613. package/dist/website_sale_stock/.kosh/schema.d.ts +2681 -0
  614. package/dist/website_sale_stock/index.d.ts +9 -0
  615. package/dist/website_sale_stock/index.js +20 -0
  616. package/dist/website_sale_stock/module.d.ts +24998 -0
  617. package/dist/website_sale_stock/module.js +28 -0
  618. package/package.json +200 -2
@@ -0,0 +1,903 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * `shutro-erp/stock` (RFC 0021): the **Stockroom** app. Warehouses and a tree of locations; the Transfer — one document
4
+ * for receipts, deliveries and internal moves — with one status chip (Draft, Waiting, Ready, Done, Cancelled);
5
+ * reservations that say what they are for; units converted exactly; stock that never goes below zero. Every company
6
+ * gets its main warehouse (`WH`, `WH/Stock`) when the app is installed or the company is created.
7
+ */
8
+ import { contacts } from '../contacts/index.js';
9
+ import { messaging } from '../messaging/index.js';
10
+ import { defineModule } from '../modules-sdk/index.js';
11
+ import { product } from '../product/index.js';
12
+ import { reporting } from '../reporting/index.js';
13
+ import { HttpProblem } from '../server/index.js';
14
+ import { orm } from '../server/orm.js';
15
+ import { action, field, form, kanban, list, search, stat } from '../views/index.js';
16
+ import { stockDemo } from './demo.js';
17
+ import { onHandIn, StockCount, StockCountLine, StockLocation, StockLot, StockLotLine, StockMove, StockPicking, StockPutaway, StockQuant, StockReorder, StockReservation, StockScrap, StockWarehouse, stockShutro, } from './module.js';
18
+ import { orderAutomatic, orderRules, refreshRules } from './replenish.js';
19
+ export { defaultLocations, inProductUnit, onHandIn, ProductStock, reserveOnConfirm, SCRAP_REASONS, StockCount, StockCountLine, StockLocation, StockLot, StockLotLine, StockMove, StockPicking, StockPutaway, StockQuant, StockReorder, StockReservation, StockScrap, StockWarehouse, stepLocation, stockShutro, warehouseStock, } from './module.js';
20
+ export { orderAutomatic, orderRules, reckon, refreshRules } from './replenish.js';
21
+ /** Every company without a warehouse gets its main one, `WH`, with its stock location `WH/Stock`. */
22
+ async function mainWarehouses(env) {
23
+ const companies = await env.model('res.company').search({});
24
+ let made = 0;
25
+ for (const company of companies.ids) {
26
+ const any = await env
27
+ .withFlags({ activeTest: false })
28
+ .model('stock.warehouse')
29
+ .search({ where: { company }, limit: 1 });
30
+ if (any.length > 0)
31
+ continue;
32
+ const warehouse = (await env.model('stock.warehouse').create([{ name: 'Main warehouse', code: 'WH', company }])).ids[0];
33
+ if (warehouse === undefined)
34
+ continue;
35
+ await env
36
+ .model('stock.location')
37
+ .create([{ name: 'Stock', usage: 'internal', warehouse, company }]);
38
+ made += 1;
39
+ }
40
+ // Checked here, in this scope (the caller's flush would run the checks without its rights).
41
+ await env.flush();
42
+ return made === 0 ? undefined : `${made} main warehouse(s) made`;
43
+ }
44
+ /**
45
+ * Counting from a phone: each scan adds to what is counted (one, or the quantity sent) — a lot or serial number's
46
+ * name counts that lot, a product's barcode the product — on the count's line, made with what is expected when it
47
+ * was not listed. As the user: their rights apply; the count must be counting.
48
+ */
49
+ function registerCountRoutes({ app }) {
50
+ app.post('/api/v1/stockroom/counts/:id/scan', async (request) => {
51
+ const id = Number(request.params.id);
52
+ if (!Number.isSafeInteger(id) || id <= 0)
53
+ throw new HttpProblem(400, 'invalid-id', 'Invalid id', 'A count id.');
54
+ const body = (request.body ?? {});
55
+ const barcode = typeof body.barcode === 'string' ? body.barcode.trim() : '';
56
+ if (barcode === '')
57
+ throw new HttpProblem(400, 'invalid-barcode', 'No barcode', 'Send the scanned barcode.');
58
+ let quantity = orm.toDecimal(1);
59
+ if (body.quantity !== undefined)
60
+ try {
61
+ quantity = orm.toDecimal(String(body.quantity));
62
+ }
63
+ catch {
64
+ throw new HttpProblem(400, 'invalid-quantity', 'Invalid quantity', 'A positive number.');
65
+ }
66
+ if (quantity.lte(0))
67
+ throw new HttpProblem(400, 'invalid-quantity', 'Invalid quantity', 'A positive number.');
68
+ return request.env(async (raw) => {
69
+ const env = raw;
70
+ const [count] = await (await env
71
+ .model('stock.count')
72
+ .search({ where: { id: orm.asId(id, 'stock.count') }, limit: 1 })).load({ location: true });
73
+ if (count === undefined)
74
+ throw new HttpProblem(404, 'missing-record', 'Not found', `There is no count ${id}.`);
75
+ if (count.state !== 'counting')
76
+ throw new HttpProblem(409, 'not-counting', 'Not counting', 'Start the count first.');
77
+ const [scannedLot] = await (await env.model('stock.lot').search({ where: { name: barcode }, limit: 1 })).load({ product: true });
78
+ const lot = scannedLot?.id ?? null;
79
+ const [found] = scannedLot !== undefined
80
+ ? [scannedLot.product]
81
+ : await (await env.model('product.product').search({ where: { barcode }, limit: 1 })).load(['name', 'kind']);
82
+ if (found === undefined)
83
+ throw new HttpProblem(404, 'unknown-barcode', 'Unknown barcode', `No product has the barcode ${barcode}.`);
84
+ const product = found.id;
85
+ const [line] = await (await env.model('stock.count.line').search({
86
+ where: { count: count.id, product, lot: lot === null ? { isNull: true } : lot },
87
+ limit: 1,
88
+ })).load(['counted', 'expected']);
89
+ const counted = (line?.counted ?? orm.toDecimal(0)).plus(quantity);
90
+ if (line !== undefined)
91
+ await line.write({ counted });
92
+ else
93
+ await env.model('stock.count.line').create([
94
+ {
95
+ count: count.id,
96
+ product,
97
+ lot,
98
+ expected: await onHandIn(env, product, count.location.id, lot),
99
+ counted,
100
+ },
101
+ ]);
102
+ await env.flush();
103
+ return {
104
+ product: found.name,
105
+ ...(scannedLot === undefined ? {} : { lot: scannedLot.name }),
106
+ counted: counted.toString(),
107
+ };
108
+ }, { write: true });
109
+ });
110
+ }
111
+ const ruleIds = (body) => {
112
+ const given = body?.['rules'];
113
+ if (given === undefined)
114
+ return undefined;
115
+ if (!Array.isArray(given) || !given.every((v) => Number.isSafeInteger(v) && Number(v) > 0))
116
+ throw new HttpProblem(400, 'invalid-rules', 'Invalid rules', 'A list of reorder rule ids.');
117
+ return given.map(Number);
118
+ };
119
+ const needs = (env, group, who) => {
120
+ if (!env.administrator && !env.groups.has(group))
121
+ throw new HttpProblem(403, 'access', who, `This needs the ${who} role.`);
122
+ };
123
+ /**
124
+ * Replenishment (RFC 0024 §2.6): the rules' figures refreshed now, the rules chosen ordered (what they propose, or
125
+ * the quantities given), snoozed for some days. Ordering makes documents in other apps (requests for quotation,
126
+ * production orders), so it runs in an audited superuser scope for Stockroom managers; the rules are read as the
127
+ * user first, so their record rules apply. Hourly on the server: every rule refreshed, the automatic ones ordered.
128
+ */
129
+ function registerReplenishmentRoutes(context) {
130
+ const { app } = context;
131
+ const visible = async (env, ids) => (await env
132
+ .model('stock.reorder')
133
+ .search(ids === undefined ? {} : { where: { id: { in: ids } } })).ids;
134
+ app.post('/api/v1/stockroom/replenishment/refresh', async (request) => {
135
+ const ids = ruleIds(request.body);
136
+ return request.env(async (raw) => {
137
+ const env = raw;
138
+ needs(env, 'stock.user', 'Stockroom user');
139
+ const rules = await visible(env, ids);
140
+ return {
141
+ rules: await env.asSuperuser({ reason: 'replenishment figures' }, (su) => refreshRules(su, rules)),
142
+ };
143
+ }, { write: true });
144
+ });
145
+ app.post('/api/v1/stockroom/replenishment/order', async (request) => {
146
+ const ids = ruleIds(request.body);
147
+ if (ids === undefined || ids.length === 0)
148
+ throw new HttpProblem(400, 'invalid-rules', 'No rules', 'Choose the rules to order.');
149
+ const given = request.body['quantities'];
150
+ const quantities = new Map();
151
+ if (given !== undefined && given !== null) {
152
+ if (typeof given !== 'object')
153
+ throw new HttpProblem(400, 'invalid-quantity', 'Invalid quantities', 'Rule id → quantity.');
154
+ for (const [k, v] of Object.entries(given)) {
155
+ let q;
156
+ try {
157
+ q = orm.toDecimal(String(v));
158
+ }
159
+ catch {
160
+ throw new HttpProblem(400, 'invalid-quantity', 'Invalid quantity', 'A positive number.');
161
+ }
162
+ if (q.lte(0))
163
+ throw new HttpProblem(400, 'invalid-quantity', 'Invalid quantity', 'A positive number.');
164
+ quantities.set(Number(k), q);
165
+ }
166
+ }
167
+ return request.env(async (raw) => {
168
+ const env = raw;
169
+ needs(env, 'stock.manager', 'Stockroom manager');
170
+ const rules = await visible(env, ids);
171
+ if (rules.length !== ids.length)
172
+ throw new HttpProblem(404, 'missing-record', 'Not found', 'A rule is not there.');
173
+ return env.asSuperuser({ reason: 'replenishment ordered' }, (su) => orderRules(su, rules, quantities));
174
+ }, { write: true });
175
+ });
176
+ app.post('/api/v1/stockroom/replenishment/snooze', async (request) => {
177
+ const ids = ruleIds(request.body);
178
+ const days = Number(request.body?.['days'] ?? 7);
179
+ if (ids === undefined || ids.length === 0)
180
+ throw new HttpProblem(400, 'invalid-rules', 'No rules', 'Choose the rules to snooze.');
181
+ if (!Number.isSafeInteger(days) || days < 0 || days > 365)
182
+ throw new HttpProblem(400, 'invalid-days', 'Invalid days', 'From 0 (wake up) to 365 days.');
183
+ return request.env(async (raw) => {
184
+ const env = raw;
185
+ needs(env, 'stock.manager', 'Stockroom manager');
186
+ const until = new Date(`${env.today()}T00:00:00Z`);
187
+ until.setUTCDate(until.getUTCDate() + days);
188
+ const rules = env.model('stock.reorder').browse((await visible(env, ids)));
189
+ await rules.write({ snoozedUntil: days === 0 ? null : until.toISOString().slice(0, 10) });
190
+ await env.flush();
191
+ return { rules: rules.length, until: days === 0 ? null : until.toISOString().slice(0, 10) };
192
+ }, { write: true });
193
+ });
194
+ if (process.env['KOSH_SCHEDULES'] === 'off')
195
+ return;
196
+ const run = async () => {
197
+ try {
198
+ const companies = await context.shutro.bootstrap({ reason: 'replenishment' }, async (env) => (await env.model('res.company').search({})).ids);
199
+ for (const company of companies)
200
+ await context.shutro.bootstrap({ reason: 'replenishment', company }, (env) => env.asSuperuser({ reason: 'replenishment' }, (su) => orderAutomatic(su)));
201
+ }
202
+ catch (error) {
203
+ app.log.error({ err: error }, 'replenishment');
204
+ }
205
+ };
206
+ const timer = setInterval(() => void run(), 3_600_000);
207
+ timer.unref();
208
+ app.addHook('onClose', async () => clearInterval(timer));
209
+ }
210
+ export const stock = defineModule({
211
+ shutro: stockShutro,
212
+ kosh: '^0.1.0',
213
+ hooks: {
214
+ defaults: async (env) => env.asSuperuser({ reason: 'main warehouses' }, (su) => mainWarehouses(su)),
215
+ demo: stockDemo,
216
+ },
217
+ // Exceptions to the module standard (RFC 0023), each with its reason.
218
+ standard: {
219
+ waive: [
220
+ {
221
+ rule: 'M3',
222
+ model: 'stock.quant',
223
+ reason: 'Stock levels, written by moves only; a level is never archived.',
224
+ },
225
+ ],
226
+ },
227
+ depends: [product, contacts, messaging, reporting],
228
+ app: {
229
+ code: 'stockroom',
230
+ label: 'Stockroom',
231
+ icon: 'stockroom',
232
+ sequence: 12,
233
+ category: 'Operations',
234
+ summary: 'Warehouses, transfers with one clear status, reservations that say what they are for',
235
+ },
236
+ accessLevels: {
237
+ user: { label: 'User (transfers, stock)', groups: ['stock.user'] },
238
+ manager: {
239
+ label: 'Manager (warehouses, locations, everything)',
240
+ groups: ['stock.manager'],
241
+ implies: ['user'],
242
+ },
243
+ },
244
+ routes: (context) => {
245
+ registerCountRoutes(context);
246
+ registerReplenishmentRoutes(context);
247
+ },
248
+ settings: {
249
+ sections: [
250
+ {
251
+ key: 'reservations',
252
+ label: 'Reservations',
253
+ description: 'When transfers hold the stock they take.',
254
+ keywords: 'reserve reservation availability transfer delivery',
255
+ scope: 'installation',
256
+ editors: ['stock.manager'],
257
+ fields: [
258
+ {
259
+ key: 'reserveOnConfirm',
260
+ type: 'boolean',
261
+ label: 'Reserve when a transfer is confirmed',
262
+ default: true,
263
+ help: 'Off: stock is reserved only with Check availability.',
264
+ },
265
+ ],
266
+ },
267
+ ],
268
+ },
269
+ // The Overview (RFC 0022 step 2).
270
+ overview: {
271
+ cards: [
272
+ {
273
+ id: 'receipts_todo',
274
+ title: 'Receipts to do',
275
+ kind: 'kpi',
276
+ model: 'stock.picking',
277
+ measure: 'count',
278
+ filter: { kind: 'receipt', status: { in: ['waiting', 'ready'] } },
279
+ w: 3,
280
+ },
281
+ {
282
+ id: 'deliveries_todo',
283
+ title: 'Deliveries to do',
284
+ kind: 'kpi',
285
+ model: 'stock.picking',
286
+ measure: 'count',
287
+ filter: { kind: 'delivery', status: { in: ['waiting', 'ready'] } },
288
+ w: 3,
289
+ },
290
+ {
291
+ id: 'done_month',
292
+ title: 'Transfers done this month',
293
+ kind: 'kpi',
294
+ model: 'stock.picking',
295
+ measure: 'count',
296
+ filter: { status: 'done' },
297
+ comparison: { field: 'scheduledDate', mode: 'previous' },
298
+ w: 3,
299
+ },
300
+ {
301
+ id: 'reservations',
302
+ title: 'Reservations',
303
+ kind: 'kpi',
304
+ model: 'stock.reservation',
305
+ measure: 'count',
306
+ w: 3,
307
+ },
308
+ {
309
+ id: 'to_reorder',
310
+ title: 'Products to reorder',
311
+ kind: 'kpi',
312
+ model: 'stock.reorder',
313
+ measure: 'count',
314
+ filter: { proposed: { gt: 0 } },
315
+ w: 3,
316
+ },
317
+ {
318
+ id: 'by_status',
319
+ title: 'Transfers by status',
320
+ kind: 'chart',
321
+ model: 'stock.picking',
322
+ measure: 'count',
323
+ groupBy: 'status',
324
+ chart: 'bar',
325
+ w: 6,
326
+ },
327
+ {
328
+ id: 'on_hand_by_location',
329
+ title: 'On hand by location',
330
+ kind: 'chart',
331
+ model: 'stock.quant',
332
+ measure: 'sum:quantity',
333
+ groupBy: 'location',
334
+ filter: { quantity: { gt: 0 } },
335
+ chart: 'bar',
336
+ w: 6,
337
+ },
338
+ {
339
+ id: 'most_stocked',
340
+ title: 'Most stocked products',
341
+ kind: 'pivot',
342
+ model: 'stock.quant',
343
+ measure: 'sum:quantity',
344
+ groupBy: 'product',
345
+ filter: { quantity: { gt: 0 } },
346
+ w: 6,
347
+ },
348
+ {
349
+ id: 'late',
350
+ title: 'Scheduled transfers',
351
+ kind: 'list',
352
+ model: 'stock.picking',
353
+ measure: 'count',
354
+ filter: { status: { in: ['waiting', 'ready'] } },
355
+ w: 6,
356
+ },
357
+ ],
358
+ },
359
+ actions: {
360
+ 'stockroom.action_transfers': action(StockPicking, {
361
+ label: 'Transfers',
362
+ views: ['list', 'kanban', 'form'],
363
+ defaults: { kind: 'internal' },
364
+ defaultFilters: ['open'],
365
+ }),
366
+ 'stockroom.action_receipts': action(StockPicking, {
367
+ label: 'Receipts',
368
+ views: ['list', 'kanban', 'form'],
369
+ defaults: { kind: 'receipt' },
370
+ defaultFilters: ['receipts', 'open'],
371
+ }),
372
+ 'stockroom.action_deliveries': action(StockPicking, {
373
+ label: 'Deliveries',
374
+ views: ['list', 'kanban', 'form'],
375
+ defaults: { kind: 'delivery' },
376
+ defaultFilters: ['deliveries', 'open'],
377
+ }),
378
+ 'stockroom.action_stock': action(StockQuant, {
379
+ label: 'Stock',
380
+ views: ['list', 'form'],
381
+ defaultFilters: ['in_stock'],
382
+ }),
383
+ 'stockroom.action_reservations': action(StockReservation, {
384
+ label: 'Reservations',
385
+ views: ['list'],
386
+ }),
387
+ 'stockroom.action_lots': action(StockLot, {
388
+ label: 'Lots and serial numbers',
389
+ views: ['list', 'form'],
390
+ defaultFilters: ['in_stock'],
391
+ }),
392
+ 'stockroom.action_scraps': action(StockScrap, {
393
+ label: 'Scrap',
394
+ views: ['list', 'form'],
395
+ }),
396
+ 'stockroom.action_counts': action(StockCount, {
397
+ label: 'Counts',
398
+ views: ['list', 'form'],
399
+ defaultFilters: ['open'],
400
+ }),
401
+ 'stockroom.action_replenishment': {
402
+ type: 'client',
403
+ page: 'stock.Replenishment',
404
+ label: 'Replenishment',
405
+ },
406
+ 'stockroom.action_putaway': action(StockPutaway, {
407
+ label: 'Putaway rules',
408
+ views: ['list', 'form'],
409
+ }),
410
+ 'stockroom.action_reorder': action(StockReorder, {
411
+ label: 'Reorder rules',
412
+ views: ['list', 'form'],
413
+ }),
414
+ 'stockroom.action_warehouses': action(StockWarehouse, {
415
+ label: 'Warehouses',
416
+ views: ['list', 'form'],
417
+ }),
418
+ 'stockroom.action_locations': action(StockLocation, {
419
+ label: 'Locations',
420
+ views: ['list', 'form'],
421
+ defaultFilters: ['internal'],
422
+ }),
423
+ },
424
+ menus: [
425
+ { id: 'stockroom.root', label: 'Stockroom', app: 'stockroom' },
426
+ {
427
+ id: 'stockroom.transfers',
428
+ parent: 'stockroom.root',
429
+ label: 'Transfers',
430
+ action: 'stockroom.action_transfers',
431
+ sequence: 1,
432
+ },
433
+ {
434
+ id: 'stockroom.receipts',
435
+ parent: 'stockroom.root',
436
+ label: 'Receipts',
437
+ action: 'stockroom.action_receipts',
438
+ sequence: 2,
439
+ },
440
+ {
441
+ id: 'stockroom.deliveries',
442
+ parent: 'stockroom.root',
443
+ label: 'Deliveries',
444
+ action: 'stockroom.action_deliveries',
445
+ sequence: 3,
446
+ },
447
+ {
448
+ id: 'stockroom.stock',
449
+ parent: 'stockroom.root',
450
+ label: 'Stock',
451
+ action: 'stockroom.action_stock',
452
+ sequence: 4,
453
+ },
454
+ {
455
+ id: 'stockroom.reservations',
456
+ parent: 'stockroom.root',
457
+ label: 'Reservations',
458
+ action: 'stockroom.action_reservations',
459
+ sequence: 5,
460
+ },
461
+ {
462
+ id: 'stockroom.lots',
463
+ parent: 'stockroom.root',
464
+ label: 'Lots and serial numbers',
465
+ action: 'stockroom.action_lots',
466
+ sequence: 5,
467
+ },
468
+ {
469
+ id: 'stockroom.counts',
470
+ parent: 'stockroom.root',
471
+ label: 'Counts',
472
+ action: 'stockroom.action_counts',
473
+ sequence: 6,
474
+ },
475
+ {
476
+ id: 'stockroom.replenishment',
477
+ parent: 'stockroom.root',
478
+ label: 'Replenishment',
479
+ action: 'stockroom.action_replenishment',
480
+ sequence: 7,
481
+ },
482
+ {
483
+ id: 'stockroom.scraps',
484
+ parent: 'stockroom.root',
485
+ label: 'Scrap',
486
+ action: 'stockroom.action_scraps',
487
+ sequence: 8,
488
+ },
489
+ {
490
+ id: 'stockroom.configuration',
491
+ parent: 'stockroom.root',
492
+ label: 'Configuration',
493
+ sequence: 9,
494
+ },
495
+ {
496
+ id: 'stockroom.warehouses',
497
+ parent: 'stockroom.configuration',
498
+ label: 'Warehouses',
499
+ action: 'stockroom.action_warehouses',
500
+ sequence: 1,
501
+ },
502
+ {
503
+ id: 'stockroom.locations',
504
+ parent: 'stockroom.configuration',
505
+ label: 'Locations',
506
+ action: 'stockroom.action_locations',
507
+ sequence: 2,
508
+ },
509
+ {
510
+ id: 'stockroom.reorder',
511
+ parent: 'stockroom.configuration',
512
+ label: 'Reorder rules',
513
+ action: 'stockroom.action_reorder',
514
+ sequence: 3,
515
+ },
516
+ {
517
+ id: 'stockroom.putaway',
518
+ parent: 'stockroom.configuration',
519
+ label: 'Putaway rules',
520
+ action: 'stockroom.action_putaway',
521
+ sequence: 4,
522
+ },
523
+ ],
524
+ views: {
525
+ 'stock.picking.list': list(StockPicking, {
526
+ columns: [
527
+ 'name',
528
+ 'kind',
529
+ 'partner',
530
+ 'source',
531
+ 'destination',
532
+ { field: 'scheduledDate', widget: 'daysLeft' },
533
+ 'origin',
534
+ { field: 'status', widget: 'badge' },
535
+ ],
536
+ decorations: {
537
+ success: { status: 'done' },
538
+ warning: { status: 'waiting' },
539
+ neutral: { status: 'cancelled' },
540
+ },
541
+ }),
542
+ 'stock.picking.kanban': kanban(StockPicking, {
543
+ groupBy: 'status',
544
+ card: {
545
+ title: 'name',
546
+ subtitle: 'partner',
547
+ color: 'kind',
548
+ footer: [{ field: 'scheduledDate', widget: 'daysLeft' }, 'origin'],
549
+ badges: [{ field: 'kind', widget: 'badge' }],
550
+ },
551
+ }),
552
+ 'stock.picking.form': form(StockPicking, (k) => ({
553
+ header: {
554
+ statusbar: 'state',
555
+ buttons: [
556
+ k.button('confirm', { primary: true, label: 'Confirm' }),
557
+ k.button('reserve', { label: 'Check availability' }),
558
+ k.button('validate', { primary: true, label: 'Validate' }),
559
+ k.button('unreserve', { label: 'Unreserve' }),
560
+ k.button('cancel', {
561
+ label: 'Cancel',
562
+ confirm: 'Cancel this transfer? Its reservations are released.',
563
+ }),
564
+ k.button('redraft', { label: 'Back to draft' }),
565
+ ],
566
+ },
567
+ sheet: [
568
+ k.group('main', ['kind', 'partner', 'warehouse', 'source', 'destination']),
569
+ k.group('when', [
570
+ 'scheduledDate',
571
+ 'doneDate',
572
+ 'origin',
573
+ 'status',
574
+ 'availability',
575
+ 'backorderOf',
576
+ 'next',
577
+ ]),
578
+ k.lines('moves', [
579
+ 'product',
580
+ 'name',
581
+ 'quantity',
582
+ 'uom',
583
+ { field: 'reserved', id: 'move_reserved' },
584
+ { field: 'quantityDone', id: 'move_done' },
585
+ { field: 'restrictLot', id: 'move_restrict_lot' },
586
+ { field: 'destination', id: 'move_put_away' },
587
+ { field: 'procurement', id: 'move_procurement', readonlyWhen: {} },
588
+ ]),
589
+ k.lines('lotLines', [
590
+ { field: 'product', id: 'lot_line_product' },
591
+ { field: 'lot', id: 'lot_line_lot' },
592
+ { field: 'lotName', id: 'lot_line_name' },
593
+ { field: 'quantity', id: 'lot_line_quantity' },
594
+ ]),
595
+ k.group('about', ['note'], { columns: 1 }),
596
+ ],
597
+ chatter: true,
598
+ })),
599
+ 'stock.quant.list': list(StockQuant, {
600
+ columns: ['product', 'location', 'lot', 'quantity', 'reserved', 'available'],
601
+ }),
602
+ 'stock.lot.list': list(StockLot, {
603
+ columns: ['name', 'product', 'expiryDate', 'qtyOnHand'],
604
+ }),
605
+ 'stock.lot.form': form(StockLot, (k) => ({
606
+ header: { buttons: [] },
607
+ sheet: [
608
+ k.group('main', ['name', 'product', 'expiryDate', 'qtyOnHand']),
609
+ k.lines('quants', [
610
+ { field: 'location', id: 'lot_quant_location' },
611
+ { field: 'quantity', id: 'lot_quant_quantity' },
612
+ { field: 'reserved', id: 'lot_quant_reserved' },
613
+ ]),
614
+ k.lines('history', [
615
+ { field: 'picking', id: 'lot_history_picking' },
616
+ { field: 'quantity', id: 'lot_history_quantity' },
617
+ ]),
618
+ k.group('about', ['note'], { columns: 1 }),
619
+ ],
620
+ chatter: true,
621
+ })),
622
+ 'stock.lot.line.list': list(StockLotLine, {
623
+ columns: ['picking', 'product', 'lot', 'lotName', 'quantity'],
624
+ }),
625
+ 'stock.quant.form': form(StockQuant, (k) => ({
626
+ header: { buttons: [] },
627
+ sheet: [
628
+ k.group('main', ['product', 'location', 'lot']),
629
+ k.group('quantities', ['quantity', 'reserved', 'available']),
630
+ k.lines('reservations', [{ field: 'label', id: 'reservation_label' }]),
631
+ ],
632
+ })),
633
+ 'stock.reservation.list': list(StockReservation, {
634
+ columns: ['label', 'quant', 'quantity', 'move'],
635
+ }),
636
+ 'stock.scrap.list': list(StockScrap, {
637
+ columns: [
638
+ 'name',
639
+ 'date',
640
+ 'product',
641
+ 'quantity',
642
+ 'reason',
643
+ { field: 'state', widget: 'badge' },
644
+ ],
645
+ }),
646
+ 'stock.scrap.form': form(StockScrap, (k) => ({
647
+ header: {
648
+ statusbar: 'state',
649
+ buttons: [
650
+ k.button('validate', {
651
+ primary: true,
652
+ label: 'Scrap',
653
+ confirm: 'Scrap it? The stock leaves for the Scrap location.',
654
+ }),
655
+ k.button('cancel', { label: 'Cancel' }),
656
+ ],
657
+ },
658
+ sheet: [
659
+ k.group('main', ['product', 'quantity', 'location', 'lot']),
660
+ k.group('why', ['reason', 'date', 'picking']),
661
+ k.group('about', ['note'], { columns: 1 }),
662
+ ],
663
+ chatter: true,
664
+ })),
665
+ 'stock.count.list': list(StockCount, {
666
+ columns: ['name', 'location', 'date', 'user', { field: 'state', widget: 'badge' }],
667
+ }),
668
+ 'stock.count.form': form(StockCount, (k) => ({
669
+ header: {
670
+ statusbar: 'state',
671
+ buttons: [
672
+ k.button('start', { primary: true, label: 'Start counting' }),
673
+ k.button('apply', {
674
+ primary: true,
675
+ label: 'Apply',
676
+ confirm: 'Apply this count? Stock is adjusted to what was counted.',
677
+ }),
678
+ k.button('cancel', { label: 'Cancel' }),
679
+ k.button('redraft', { label: 'Back to draft' }),
680
+ ],
681
+ },
682
+ sheet: [
683
+ k.group('main', ['location', 'date', 'user']),
684
+ k.component('scan', 'stock.Scan'),
685
+ k.lines('lines', [
686
+ { field: 'product', id: 'count_product' },
687
+ { field: 'lot', id: 'count_lot' },
688
+ { field: 'expected', id: 'count_expected' },
689
+ { field: 'counted', id: 'count_counted' },
690
+ { field: 'difference', id: 'count_difference' },
691
+ ]),
692
+ k.group('about', ['note'], { columns: 1 }),
693
+ ],
694
+ chatter: true,
695
+ })),
696
+ 'stock.count.line.list': list(StockCountLine, {
697
+ columns: ['count', 'product', 'expected', 'counted', 'difference'],
698
+ }),
699
+ 'stock.warehouse.list': list(StockWarehouse, { columns: ['name', 'code', 'address'] }),
700
+ 'stock.warehouse.form': form(StockWarehouse, (k) => ({
701
+ header: { buttons: [] },
702
+ sheet: [
703
+ k.group('main', ['name', 'code', 'address']),
704
+ k.group('routes', ['receptionSteps', 'deliverySteps'], {
705
+ label: 'Routes',
706
+ description: 'In two or three steps, a receipt goes into Input and on through Quality control to stock; a delivery leaves from Output after a pick (and a pack). Each step is its own transfer, made when the one before it is done.',
707
+ }),
708
+ k.lines('locations', [
709
+ { field: 'name', id: 'location_name' },
710
+ { field: 'usage', id: 'location_usage' },
711
+ { field: 'parent', id: 'location_parent' },
712
+ { field: 'step', id: 'location_step' },
713
+ ]),
714
+ ],
715
+ })),
716
+ 'stock.location.list': list(StockLocation, {
717
+ columns: ['fullName', 'usage', 'warehouse', 'step'],
718
+ }),
719
+ 'stock.putaway.list': list(StockPutaway, {
720
+ columns: ['location', 'product', 'category', 'destination', 'sequence'],
721
+ }),
722
+ 'stock.putaway.form': form(StockPutaway, (k) => ({
723
+ sheet: [
724
+ k.group('main', ['location', 'product', 'category', 'destination', 'sequence'], {
725
+ description: 'What arrives in the location — this product, or any product of this category — is put away in the location inside it.',
726
+ }),
727
+ ],
728
+ })),
729
+ 'stock.location.form': form(StockLocation, (k) => ({
730
+ header: { buttons: [] },
731
+ sheet: [k.group('main', ['name', 'parent', 'warehouse', 'usage', 'fullName'])],
732
+ })),
733
+ 'stock.reorder.list': list(StockReorder, {
734
+ columns: [
735
+ 'product',
736
+ 'warehouse',
737
+ 'method',
738
+ 'trigger',
739
+ 'minimum',
740
+ 'maximum',
741
+ 'forecast',
742
+ 'proposed',
743
+ 'lastOrder',
744
+ ],
745
+ decorations: { warning: { proposed: { gt: 0 } } },
746
+ }),
747
+ 'stock.reorder.form': form(StockReorder, (k) => ({
748
+ sheet: [
749
+ k.group('rule', ['product', 'warehouse', 'minimum', 'maximum', 'multiple'], {
750
+ description: 'Below the minimum, the forecast proposes enough to reach the maximum, in steps of the multiple.',
751
+ }),
752
+ k.group('how', ['method', 'trigger', 'vendor', 'sourceWarehouse', 'leadDays', 'auto', 'snoozedUntil'], {
753
+ label: 'How it is ordered',
754
+ }),
755
+ k.group('figures', ['onHand', 'forecast', 'proposed', 'explanation', 'refreshedAt', 'lastOrder'], {
756
+ label: 'Forecast',
757
+ }),
758
+ ],
759
+ chatter: true,
760
+ })),
761
+ 'stock.move.list': list(StockMove, {
762
+ columns: ['picking', 'product', 'quantity', 'uom', 'reserved'],
763
+ }),
764
+ },
765
+ search: {
766
+ 'stock.picking': search(StockPicking, {
767
+ fields: ['name', 'origin', 'partner.name', 'moves.product.name'],
768
+ filters: {
769
+ open: {
770
+ label: 'To do',
771
+ domain: { state: { in: ['draft', 'confirmed'] } },
772
+ group: 'state',
773
+ },
774
+ ready: { label: 'Ready', domain: { status: 'ready' }, group: 'state' },
775
+ waiting: { label: 'Waiting', domain: { status: 'waiting' }, group: 'state' },
776
+ done: { label: 'Done', domain: { state: 'done' }, group: 'state' },
777
+ receipts: { label: 'Receipts', domain: { kind: 'receipt' }, group: 'kind' },
778
+ deliveries: { label: 'Deliveries', domain: { kind: 'delivery' }, group: 'kind' },
779
+ dropships: { label: 'Dropships', domain: { kind: 'dropship' }, group: 'kind' },
780
+ internal: { label: 'Internal moves', domain: { kind: 'internal' }, group: 'kind' },
781
+ steps: {
782
+ label: 'Steps of a route',
783
+ domain: { or: [{ next: { isNull: false } }, { 'source.step': { isNull: false } }] },
784
+ group: 'kind',
785
+ },
786
+ },
787
+ groupBy: ['kind', 'status', 'partner', 'scheduledDate'],
788
+ }),
789
+ 'stock.quant': search(StockQuant, {
790
+ fields: ['product.name', 'location.fullName'],
791
+ filters: {
792
+ in_stock: { label: 'In stock', domain: { quantity: { gt: 0 } } },
793
+ reserved: { label: 'Reserved', domain: { reserved: { gt: 0 } } },
794
+ },
795
+ groupBy: ['product', 'location'],
796
+ }),
797
+ 'stock.reservation': search(StockReservation, {
798
+ fields: ['label', 'quant.product.name'],
799
+ groupBy: ['quant'],
800
+ }),
801
+ 'stock.warehouse': search(StockWarehouse, { fields: ['name', 'code'] }),
802
+ 'stock.count': search(StockCount, {
803
+ fields: ['name', 'location.fullName'],
804
+ filters: {
805
+ open: { label: 'To do', domain: { state: { in: ['draft', 'counting'] } } },
806
+ applied: { label: 'Applied', domain: { state: 'done' } },
807
+ },
808
+ groupBy: ['location', 'user'],
809
+ }),
810
+ 'stock.scrap': search(StockScrap, {
811
+ fields: ['name', 'product.name'],
812
+ groupBy: ['reason', 'product', 'date'],
813
+ }),
814
+ 'stock.count.line': search(StockCountLine, { fields: ['product.name', 'count.name'] }),
815
+ 'stock.lot': search(StockLot, {
816
+ fields: ['name', 'product.name'],
817
+ filters: {
818
+ in_stock: { label: 'In stock', domain: { qtyOnHand: { gt: 0 } } },
819
+ },
820
+ groupBy: ['product', 'expiryDate'],
821
+ }),
822
+ 'stock.lot.line': search(StockLotLine, {
823
+ fields: ['lot.name', 'product.name', 'picking.name'],
824
+ }),
825
+ 'stock.location': search(StockLocation, {
826
+ fields: ['fullName'],
827
+ filters: { internal: { label: 'Internal', domain: { usage: 'internal' } } },
828
+ groupBy: ['warehouse', 'usage'],
829
+ }),
830
+ 'stock.move': search(StockMove, { fields: ['product.name', 'picking.name'] }),
831
+ 'stock.putaway': search(StockPutaway, {
832
+ fields: ['location.fullName', 'product.name', 'category.name'],
833
+ groupBy: ['location', 'category'],
834
+ }),
835
+ 'stock.reorder': search(StockReorder, {
836
+ fields: ['product.name', 'warehouse.name', 'vendor.name'],
837
+ filters: {
838
+ to_order: { label: 'To order', domain: { proposed: { gt: 0 } }, group: 'state' },
839
+ snoozed: { label: 'Snoozed', domain: { snoozedUntil: { isNull: false } }, group: 'state' },
840
+ automatic: { label: 'Ordered automatically', domain: { auto: true } },
841
+ },
842
+ groupBy: ['warehouse', 'method', 'vendor'],
843
+ }),
844
+ },
845
+ // Products show what they have in stock, where, and what is reserved.
846
+ viewExtensions: [
847
+ {
848
+ view: 'product.product.form',
849
+ operations: [
850
+ {
851
+ append: 'related',
852
+ nodes: [
853
+ stat({
854
+ id: 'product_on_hand',
855
+ label: 'On hand',
856
+ model: 'stock.quant',
857
+ where: { product: { $record: 'id' }, 'location.usage': 'internal' },
858
+ measure: { sum: 'quantity' },
859
+ action: 'stockroom.action_stock',
860
+ }),
861
+ stat({
862
+ id: 'product_reorder',
863
+ label: 'Reorder rules',
864
+ model: 'stock.reorder',
865
+ where: { product: { $record: 'id' } },
866
+ action: 'stockroom.action_reorder',
867
+ }),
868
+ ],
869
+ },
870
+ ],
871
+ },
872
+ {
873
+ view: 'product.product.form',
874
+ operations: [
875
+ {
876
+ insertAfter: 'prices',
877
+ nodes: [
878
+ {
879
+ kind: 'group',
880
+ id: 'stock_quantities',
881
+ label: 'Stock',
882
+ children: [
883
+ field({ field: 'tracking', id: 'stock_tracking' }),
884
+ field({ field: 'qtyOnHand', id: 'stock_on_hand' }),
885
+ field({ field: 'qtyReserved', id: 'stock_reserved' }),
886
+ field({ field: 'qtyAvailable', id: 'stock_available' }),
887
+ ],
888
+ },
889
+ ],
890
+ },
891
+ ],
892
+ },
893
+ {
894
+ view: 'product.product.list',
895
+ operations: [
896
+ {
897
+ insertAfter: 'listPrice',
898
+ nodes: [field({ field: 'qtyAvailable', id: 'stock_list_available' })],
899
+ },
900
+ ],
901
+ },
902
+ ],
903
+ });