Inventory and Stock¶
Current authority¶
Google Sheets is still the practical inventory authority.
Core tabs:
Imports: batch-level receipt, landed cost, status, andQuantity Remaining.Inventory: formula-driven SKU aggregation.ProductName/Variation: canonicalization and dropdown support.- Marketplace tabs (
Shopee,Lazada) andOrders: order-line projections used by allocation.
How allocation works today¶
New allocatable rows carry Status = For Allocation. Apps Script then:
- Finds an arrived import row for the same SKU with enough quantity.
- Subtracts from
Imports.Quantity Remaining. - Writes allocation/import status back to the order line.
- Supports reversal/cancellation paths that attempt to restore quantity.
Important fragility¶
This is a business-critical inventory transaction implemented as several Google Sheet writes. It is not a database transaction and has no durable idempotency key or row-level lock.
Failure modes:
- Row insertion/sorting can move records while scripts infer position.
- Reversal can depend on mutable current SKU/quantity fields.
- Missing allocation quantity can prevent exact reversal.
- Concurrent edits/triggers can race.
Marketplace stock sync¶
exzen-core currently pushes stock back to marketplaces as part of its scheduled loop.
tcg-platform also has marketplace stock sync code, but its sync toggles are off. Do not enable tcg-platform marketplace stock sync while exzen-core stock sync is still active, or there will be competing inventory writers.