Check lot quantities

This commit is contained in:
2026-05-13 19:29:24 +02:00
parent 26c955ef53
commit 14ba0361d2
5 changed files with 116 additions and 18 deletions

View File

@@ -227,6 +227,10 @@ Invariants to preserve after every update:
where `lot_p = virtual lot`, whether they are matched to a `lot_s` or not.
- For a sale virtual lot, the second invariant sums all `lot.qt` lines where
`lot_s = virtual lot`, whether they are linked to a `lot_p` or not.
- A zero `lot.qt` row is accepted if it still keeps at least one `lot_p` or
`lot_s` link: it is then the memory of a consumed forecast.
- A `lot.qt` row without both `lot_p` and `lot_s` is blocked by
`lot.qt.validate`.
- The technical guard is centralized in
`lot.lot.assert_lines_quantity_consistency()` and must be called at the end
of flows that modify lots, matching, transport, weighing, or the contractual