c94ddd34c78c7bbb517dc952aed60781c65b5049
products.productstatus is a per-product lifecycle field holding "Active"/"Inactive". CreateProductStock overwrote it with "available" on every stock receipt — an availability value written into a lifecycle column — which destroyed the real lifecycle state of the rows it touched. 136 products now read "available" and 12 "outofstock" with no way to recover what they were. A single column on products cannot express availability anyway: the same product can be stocked at one outlet and empty at another. That fact belongs to productlocations.status, which SyncProductLocationStatus already derives from the ledger, so the receipt path now updates only that and leaves productstatus alone. UpdateProductStatus remains available as an explicit admin operation; it is simply no longer called as a side effect of stock movement. GetProductCount counted available/outofstock off the same corrupted column and returned near-nonsense as a result: across 6245 products it matched 'available' on 136 and 'outofstock' on 12, leaving 6097 — the real answer — uncounted under "Active". It now derives both from the ledger, counting a product available when it holds positive stock at any of the tenant's outlets, so total = available + outofstock (6245 = 22 + 6223). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Description
No description provided
Languages
Go
99.2%
JavaScript
0.7%