Issue Title: Allow Multiple Quality Inspections for a Single Item in Purchase Receipt
Issue Type: Feature Request
ERPNext Version: 15
Description
Currently, in ERPNext version 15, once a Quality Inspection (QI) report is submitted for an item in a Purchase Receipt, it prevents the creation of additional QI reports for the same item. This limitation poses a challenge when multiple inspections are needed for the same item, especially when the total quantity received needs to be individually inspected in separate batches or serial numbers.
Proposed Solution
Allow the creation of multiple Quality Inspection reports for a single item in a Purchase Receipt until the total quantity is inspected. This feature would enhance the flexibility and accuracy of the quality control process, particularly for items managed with batches or serial numbers.
Steps to Implement
- Add a Custom Field in Purchase Receipt Item:
- Field Name: inspections_completed
- Field Type: Int
- Purpose: Track the number of inspections completed for each item.
- Modify Quality Inspection Logic:
- Allow the creation of multiple QI reports linked to a single item in a Purchase Receipt.
- Ensure the system checks the inspections_completed against the total quantity received before allowing new QI report creation.
- Include Batch and Serial Number in Quality Inspection:
- Ensure each Quality Inspection can specify the batch or serial number of the inspected items.
- Server Script for On Submit in Quality Inspection:
- Increment the inspections_completed field in the related Purchase Receipt Item each time a QI report is saved.
purchase_receipt_item = frappe.get_doc('Purchase Receipt Item', {
'parent': doc.reference_name,
'item_code': doc.item_code
})
if purchase_receipt_item.inspections_completed >= purchase_receipt_item.qty:
frappe.throw('All quantities have already been inspected.')
purchase_receipt_item.inspections_completed += 1
purchase_receipt_item.save()
Benefits
- Allows for more granular and accurate quality control processes.
- Supports scenarios where individual items or batches need separate inspection reports.
- Enhances the flexibility of the quality inspection process, particularly in industries requiring detailed inspections for each unit, batch, or serial number received.
Additional Information
- This feature request aims to improve the standard workflow without requiring significant customization from users.
- Feedback and suggestions from the community are welcome to refine the proposed solution further.