Feature Requirement: BOM Validity Period (Start and End Dates)
| Ver | Date | User | Changes |
|---|---|---|---|
| 1.0 | 20240527 | hunglq | Initial creation of BOM validity period feature requirement |
User Story
As a production planner or engineer using ERPNext, I want to set start and end dates for the validity of a BOM so that the system automatically recognizes when a BOM is active or expired. This helps ensure that outdated materials or processes are no longer used in production planning and manufacturing.
Overview
Description:
This feature enables users to define a validity period for each Bill of Materials (BOM) by specifying start and end dates. During BOM creation and update, users will input these dates. The system will enforce validity constraints, such as preventing the use of expired BOMs in production plans and blocking changes to BOM validity if the BOM is already referenced in active production plans.
Purpose:
To improve the accuracy and control of production processes by ensuring only valid BOMs are used, preventing outdated materials or configurations from being applied.
Target Users:
Production planners, manufacturing engineers, procurement staff, and ERPNext administrators involved in BOM management and production planning.
Assumptions
- The ERPNext system supports date fields and relevant validations.
- Production plans and other dependent documents reference BOMs by unique identifiers.
- Users have sufficient permissions to create and update BOMs.
- Existing BOMs may or may not have validity dates — for backward compatibility, such BOMs are considered valid indefinitely unless dates are set.
- BOM usage in production plans can be queried efficiently.
Acceptance Criteria
Criterion 1: Users can specify a start date and an end date for the validity period when creating or updating a BOM.
Test: Create a new BOM and set start = 2024-06-01 and end = 2024-12-31; verify dates are saved correctly.Criterion 2: The system prevents setting an end date earlier than the start date.
Test: Attempt to save a BOM with end date before start date and confirm the validation error is shown.Criterion 3: If a BOM is already used in any active or completed production plan, the system disallows changing the BOM’s start or end dates.
Test: Associate a BOM with a production plan; attempt to edit the validity dates and verify the update is rejected with an appropriate message.Criterion 4: BOMs with no set validity dates are treated as valid indefinitely.
Test: Create a BOM with empty start/end dates and verify it can be selected for production plans at any date.Criterion 5: When creating or updating a production plan, the system warns or blocks selection of BOMs that are expired (current date is after their end date).
Test: Attempt to select a BOM with an end date in the past for a new production plan and verify the system shows an error or prevents selection.Criterion 6: The BOM listing and detail views display the validity period clearly.
Test: Open a BOM record and confirm start and end dates are visible and formatted consistently.Criterion 7: Expired BOMs are still viewable but cannot be used in new production plans.
Test: Search for expired BOMs; verify that they appear in lists but cannot be selected where usage is intended.Criterion 8: Users with sufficient rights can delete or archive expired BOMs but should be warned if referenced in production plans.
Test: Try to delete a BOM referenced in a production plan and verify the system prevents this with a warning.
Constraints
- Validity dates must be in date format (YYYY-MM-DD).
- Updates to validity dates are blocked if the BOM is referenced in production plans.
- The system must maintain backward compatibility with existing BOMs that do not have validity dates.
- User interface forms must clearly indicate required fields and provide tooltips about validity period usage.
- The validity period applies only to production planning and does not affect BOM costing or historical data reporting.
- Timezone consistency - all date fields should be treated as server/local timezone dates without time components.
Technical Requirements
- Database: Add two new date fields and to the BOM master data schema.
- Validation: Enforce at data entry level.
- Business Logic:
- Prevent selection of expired BOMs in production plans.
- Prevent modifying validity dates if BOM is referenced in any existing production plan.
- UI:
- Date pickers for start and end dates in BOM creation and update forms.
- Visual indicators (e.g., color-coded labels) showing active/expired status on BOM list and detail views.
- API: Support validity dates in BOM APIs for integrations and automated validations.
- Notification: Provide explicit error or warning messages when an action is disallowed due to validity constraints.
- Backward Compatibility: Existing BOMs without dates are treated as always valid.
- Performance: Ensure validation queries for production plans referencing a BOM are optimized to avoid latency on BOM updates.
Notes
- Consider allowing optional override permissions for administrators to update validity dates on BOMs used in production plans, with audit trail.
- Expired BOMs can still be used for historical reporting or quality audits.
- Align terminology with existing ERPNext standards to maintain UI consistency.
- Potential future enhancement: system automatically suggests archiving expired BOMs.
- Ensure proper unit and integration tests to cover all acceptance criteria, especially around production plan locking logic.
