fix(stock): enable quality inspection for all Stock Entry purposes

- Remove `depends_on` restriction from `inspection_required` field so it
  is visible for all Stock Entry purposes, not just Manufacture
- Fix `check_item_quality_inspection` to return items for Stock Entry
  (was returning [] for unknown doctypes, blocking QI creation flow)
- Fix `inspection_type` in transaction.js to be purpose-aware: Manufacture
  and Material Receipt → "Incoming"; all other purposes → "Outgoing"

(cherry picked from commit dceb9a3c6c)

# Conflicts:
#	erpnext/stock/doctype/stock_entry/stock_entry.json
This commit is contained in:
Sudharsanan11
2026-06-11 18:58:22 +05:30
committed by Mergify
parent 0326793355
commit a6310351fd
4 changed files with 21 additions and 13 deletions

View File

@@ -2163,7 +2163,7 @@ def check_item_quality_inspection(doctype: str, docstatus: str | int, items: str
inspection_fieldname = inspection_fieldname_map.get(doctype)
if inspection_fieldname is None:
return []
return items if doctype == "Stock Entry" else []
allow_after_transaction = cint(docstatus) == 1 and frappe.get_single_value(
"Stock Settings", "allow_to_make_quality_inspection_after_purchase_or_delivery"

View File

@@ -389,11 +389,13 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
);
}
const inspection_type = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"].includes(
this.frm.doc.doctype
)
? "Incoming"
: "Outgoing";
const incoming_doctypes = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"];
const incoming_purposes = ["Manufacture", "Material Receipt"];
const inspection_type =
incoming_doctypes.includes(this.frm.doc.doctype) ||
(this.frm.doc.doctype === "Stock Entry" && incoming_purposes.includes(this.frm.doc.purpose))
? "Incoming"
: "Outgoing";
let quality_inspection_field = this.frm.get_docfield("items", "quality_inspection");
quality_inspection_field.get_route_options_for_new_doc = function (row) {
@@ -2885,11 +2887,13 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
];
const me = this;
const inspection_type = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"].includes(
this.frm.doc.doctype
)
? "Incoming"
: "Outgoing";
const incoming_doctypes = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"];
const incoming_purposes = ["Manufacture", "Material Receipt"];
const inspection_type =
incoming_doctypes.includes(this.frm.doc.doctype) ||
(this.frm.doc.doctype === "Stock Entry" && incoming_purposes.includes(this.frm.doc.purpose))
? "Incoming"
: "Outgoing";
const dialog = new frappe.ui.Dialog({
title: __("Select Items for Quality Inspection"),
size: "extra-large",

View File

@@ -216,10 +216,11 @@ frappe.ui.form.on("Stock Entry", {
}
let quality_inspection_field = frm.get_docfield("items", "quality_inspection");
const incoming_purposes = ["Manufacture", "Material Receipt"];
quality_inspection_field.get_route_options_for_new_doc = function (row) {
if (frm.is_new()) return {};
return {
inspection_type: "Incoming",
inspection_type: incoming_purposes.includes(frm.doc.purpose) ? "Incoming" : "Outgoing",
reference_type: frm.doc.doctype,
reference_name: frm.doc.name,
child_row_reference: row.doc.name,

View File

@@ -259,7 +259,6 @@
},
{
"default": "0",
"depends_on": "eval: doc.purpose === \"Manufacture\"",
"fieldname": "inspection_required",
"fieldtype": "Check",
"label": "Inspection Required"
@@ -769,7 +768,11 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
<<<<<<< HEAD
"modified": "2026-03-04 19:03:23.426082",
=======
"modified": "2026-06-11 18:23:12.340065",
>>>>>>> dceb9a3c6c (fix(stock): enable quality inspection for all Stock Entry purposes)
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry",