From 3fdcd33b922806038f1a61f9e94eb0f73c1304e6 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Wed, 23 Aug 2023 12:15:35 +0530 Subject: [PATCH] feat: `Quality Inspection` in `Subcontracting Receipt` --- erpnext/controllers/stock_controller.py | 1 + .../stock/doctype/quality_inspection/quality_inspection.json | 4 ++-- .../doctype/subcontracting_receipt/subcontracting_receipt.py | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index d669abe910..ae54b801f1 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -599,6 +599,7 @@ class StockController(AccountsController): inspection_fieldname_map = { "Purchase Receipt": "inspection_required_before_purchase", "Purchase Invoice": "inspection_required_before_purchase", + "Subcontracting Receipt": "inspection_required_before_purchase", "Sales Invoice": "inspection_required_before_delivery", "Delivery Note": "inspection_required_before_delivery", } diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.json b/erpnext/stock/doctype/quality_inspection/quality_inspection.json index db9322f326..914a9f3c21 100644 --- a/erpnext/stock/doctype/quality_inspection/quality_inspection.json +++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.json @@ -74,7 +74,7 @@ "fieldname": "reference_type", "fieldtype": "Select", "label": "Reference Type", - "options": "\nPurchase Receipt\nPurchase Invoice\nDelivery Note\nSales Invoice\nStock Entry\nJob Card", + "options": "\nPurchase Receipt\nPurchase Invoice\nSubcontracting Receipt\nDelivery Note\nSales Invoice\nStock Entry\nJob Card", "reqd": 1 }, { @@ -245,7 +245,7 @@ "index_web_pages_for_search": 1, "is_submittable": 1, "links": [], - "modified": "2022-10-04 22:00:13.995221", + "modified": "2023-08-23 11:56:50.282878", "modified_by": "Administrator", "module": "Stock", "name": "Quality Inspection", diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py index 60746d95f3..58afc2f9aa 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py @@ -81,6 +81,9 @@ class SubcontractingReceipt(SubcontractingController): self.validate_posting_time() self.validate_rejected_warehouse() + if not self.get("is_return"): + self.validate_inspection() + if getdate(self.posting_date) > getdate(nowdate()): frappe.throw(_("Posting Date cannot be future date"))