odoo-valuation-repairlisted
Install: claude install-skill tuanle96/odoo-ai-skills
# Broken inventory valuation — diagnose, repair, prevent
**The invariant:** for every storable product, `Σ stock.valuation.layer.quantity`
(the *book*) must equal physical stock in **valued** locations (`internal` +
company-owned `transit`, mirroring `stock.location._should_be_valued()`). The
displayed AVCO cost is just `value_svl ÷ quantity_svl` — when the book drifts,
the denominator hovers near zero and the "cost" becomes noise: negative,
absurdly large, and swinging on every move.
**A negative cost is never the disease — it is the visible symptom of a broken
book.** Products whose garbage cost happens to still be *positive* are the
silent majority (a repeating decimal like `505352.312312…` betrays a tiny
denominator). Any monitor that only alerts on `standard_price <= 0` misses
them; the drift check below does not.
Targets Odoo 17/18 (18 specifics flagged). SaaS-safe: everything here runs
through XML-RPC + a server action — no shell or SQL console needed on the
target.
## Diagnose (read-only, ~15 min)
Run the ladder in order — each answer narrows the next question:
1. **Formula check.** Read `quantity_svl`, `value_svl`, `qty_available`,
`standard_price` on the product. `standard_price == value_svl /
quantity_svl` with a tiny (or negative) `quantity_svl` while
`qty_available` is large ⇒ drift confirmed. The number changing hour to
hour is the same symptom (denominator near 0), not "the cost moving".
2. **Counterpart mass.** `read_group` quants by `locatio