A minimum shelf life on a batch received
The customer asks: Refuse a batch whose remaining shelf life is below our minimum, unless a named role accepts it
- Verdict: Ready, with limits (4)
- Door: Save rules · area: Stock and buying › Batches and expiry
- Recipe: Save rules: one tax id per customer group, and a submit kept for a role
- Sample: none yet
- Checked: run by the product 2026-10-17 (its walk in Desk's own form: a stock user's batch below the limit refused, the settings role's holder let through, a description edit saved, an expiry edit judged again, the limit changed in the settings record and followed); not run on a sandbox
What you build
From POS build 2.0.0.654: three Batch fields (days left, shelf days, shelf %), a settings record with the limit and a role, and five save rules, in order: two days_between (days left, shelf days), a percent, a limit shelf days > 0 judged at every save, and a limit shelf % ≥ limit judged on change, its limit and role read from the settings record (contracts/pages/save_rules.md §8, the worked example; recipes/save_rules.md).
Limits
- A batch a receipt makes, or a split makes, is judged at its first later save, not at the receipt; a bulk batch insert runs no rule.
- A save that empties a date passes and leaves the shelf % empty: list the batches with an empty shelf % before switching the rules on, and after, as a standing check.
- Switch the shelf days > 0 limit off together with its derived rule.
- A figure the limit judges is never made mandatory.
Tell the customer
A batch with less shelf life left than your minimum is refused when it is saved, unless the person saving holds the role you name; a batch made by a receipt is judged at its first later save.
What next
- Tell the customer the 4 limits above, and write them into the proposal.
- Follow the recipe: Save rules: one tax id per customer group, and a submit kept for a role.
- Build and test it on your sandbox (request one if you have none; what is on it).
- Run the checks: your own tests, the kit's checks and the money kit's release gate (testing and release).
- Release through the customer's own release gate (14. Testing and release); an app other shops install goes through the App library.
Related needs
- A field filled in from other fields when the record is saved — Ready, with limits (3)
- Change the limits and who is told in one settings page, not in each rule — Ready, with limits (3)
- No more than so many manager discount approvals per store per day — Ready, with limits (5)
- Only the receiving store receives a transfer; only a supervisor cancels it — Ready, with limits (4)
Start a project shortlist with this need · Put it in your blueprint · Every need