Repository navigation
Add planned builds (reserve part stock for future project builds) - #1567
kernchen-brc wants to merge 2 commits into
Conversation
…Authored-By: Claude Sonnet 5.5)
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1567 +/- ##
============================================
+ Coverage 62.97% 63.26% +0.28%
- Complexity 10071 10358 +287
============================================
Files 748 762 +14
Lines 32315 33194 +879
============================================
+ Hits 20351 20999 +648
- Misses 11964 12195 +231 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hi @jbtronics, some context from the user side: @kernchen-brc is a student in my hardware development team at BRC Solar. We use Part-DB as our central parts library for prototyping (several hundred parts, and the source for our lab side internal part numbers). Planned builds address a real gap for us. When we plan a prototype run, we need to know early whether the parts are in stock, and make sure nobody uses them for something else before the build. Today this happens outside Part-DB [in spreadsheets / by hand], which is exactly what we wanted to move away from. We know this is a large PR and that it changes existing behaviour (withdraw/move now check against the available amount). To make reviewing easier, we’re happy to: split it into smaller PRs, e.g. reservations + available amount first, planned-build UI second, Would you be open to this feature in general? If so, what would you like to see before reviewing it? Thanks a lot for Part-DB! |
Summary
Adds planned builds: a way to reserve the parts a project needs for a future build, without removing them from the inventory yet. Reserved stock is excluded from what can be withdrawn, moved or used by other builds, until the plan is built or cancelled.
Stock is now tracked as Total = Available + Reserved per lot and per part. This is shown on the part page, can be shown as table columns (
Reserved,Available) and is part of the API (reserved_amount,available_amounton part lots).How it works
planned_projects.built_parts).Changes to existing behaviour
parts.editnow also sets the newparts_stock.reserve/releasepermissions.Database / permissions
Version20260929120000createsplanned_projectsandpart_lot_reservations(MySQL, SQLite, PostgreSQL).Version20260929130000copies existingprojectspermissions to the newplanned_projectspermission, andparts_stock.withdraw/addto the newparts_stock.reserve/release, so existing installs and admins see the feature right away. The permission presets for new installs are updated too.planned_projects(read/edit/create/delete/show_history/revert_element/import),parts_stock.reserve,parts_stock.release.Other
LogTargetType,ElementTypes,EntityURLGenerator, the log filter and the cache invalidation listener, so logging, history links and the sidebar work.docs/usage/planned_builds.md. English translations are added tomessages.en.xlf/validators.en.xlf(other languages are left to Crowdin).Testing
composer phpstan(level 5),lint:twig,lint:yamlanddoctrine:schema:validate --skip-syncpass. The migrations run from scratch on SQLite; I did not run them on MySQL or PostgreSQL.PlannedProjectentity, sidebar tree builder, and a functional controller test (parts without lots are listed, sorting, building keeps the plan, active reservations block part deletion and manual withdrawal).PartLot/withdraw tests are extended, and the new pages are added to the availability tests.Notes for reviewers
built_partssnapshot, so it does not block deleting parts, lots or projects and does not slow down the stock calculations.ON DELETE CASCADE.🤖 Generated with Claude Code