From 8eaa2afeb7f5716a931dfc099c886d28097eaec9 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 10 Apr 2025 16:28:23 +0530 Subject: [PATCH] feat: Allow to Make Quality Inspection after Purchase / Delivery --- .../quality_inspection/quality_inspection.py | 5 +++ .../stock_settings/stock_settings.json | 44 +++++++++++++------ .../doctype/stock_settings/stock_settings.py | 1 + 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py index bf1c918668f..8aed2277de3 100644 --- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py +++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py @@ -144,6 +144,11 @@ class QualityInspection(Document): child_row_references.remove(child_row_references[0]) def validate_inspection_required(self): + if frappe.db.get_single_value( + "Stock Settings", "allow_to_make_quality_inspection_after_purchase_or_delivery" + ): + return + if self.reference_type in ["Purchase Receipt", "Purchase Invoice"] and not frappe.get_cached_value( "Item", self.item_code, "inspection_required_before_purchase" ): diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json index 306456ecc45..6b1e90432b8 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.json +++ b/erpnext/stock/doctype/stock_settings/stock_settings.json @@ -35,18 +35,6 @@ "show_barcode_field", "clean_description_html", "allow_internal_transfer_at_arms_length_price", - "quality_inspection_settings_section", - "action_if_quality_inspection_is_not_submitted", - "column_break_23", - "action_if_quality_inspection_is_rejected", - "stock_reservation_tab", - "enable_stock_reservation", - "auto_reserve_stock", - "column_break_rx3e", - "allow_partial_reservation", - "auto_reserve_stock_for_sales_order_on_purchase", - "serial_and_batch_reservation_section", - "auto_reserve_serial_and_batch", "serial_and_batch_item_settings_tab", "section_break_7", "allow_existing_serial_no", @@ -63,6 +51,21 @@ "use_naming_series", "column_break_wslv", "naming_series_prefix", + "stock_reservation_tab", + "enable_stock_reservation", + "auto_reserve_stock", + "column_break_rx3e", + "allow_partial_reservation", + "auto_reserve_stock_for_sales_order_on_purchase", + "serial_and_batch_reservation_section", + "auto_reserve_serial_and_batch", + "quality_tab", + "quality_inspection_settings_section", + "action_if_quality_inspection_is_not_submitted", + "column_break_23", + "action_if_quality_inspection_is_rejected", + "section_break_uiau", + "allow_to_make_quality_inspection_after_purchase_or_delivery", "stock_planning_tab", "auto_material_request", "auto_indent", @@ -511,6 +514,21 @@ "fieldname": "allow_uom_with_conversion_rate_defined_in_item", "fieldtype": "Check", "label": "Allow UOM with Conversion Rate Defined in Item" + }, + { + "fieldname": "quality_tab", + "fieldtype": "Tab Break", + "label": "Quality" + }, + { + "fieldname": "section_break_uiau", + "fieldtype": "Section Break" + }, + { + "default": "0", + "fieldname": "allow_to_make_quality_inspection_after_purchase_or_delivery", + "fieldtype": "Check", + "label": "Allow to Make Quality Inspection after Purchase / Delivery" } ], "icon": "icon-cog", @@ -518,7 +536,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2025-03-31 15:34:20.752065", + "modified": "2025-04-10 16:19:31.210007", "modified_by": "Administrator", "module": "Stock", "name": "Stock Settings", diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.py b/erpnext/stock/doctype/stock_settings/stock_settings.py index 55ecdb1992f..5dd27a0d7ec 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.py +++ b/erpnext/stock/doctype/stock_settings/stock_settings.py @@ -33,6 +33,7 @@ class StockSettings(Document): allow_partial_reservation: DF.Check allow_to_edit_stock_uom_qty_for_purchase: DF.Check allow_to_edit_stock_uom_qty_for_sales: DF.Check + allow_to_make_quality_inspection_after_purchase_or_delivery: DF.Check allow_uom_with_conversion_rate_defined_in_item: DF.Check auto_create_serial_and_batch_bundle_for_outward: DF.Check auto_indent: DF.Check