mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-15 15:38:39 +00:00
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:
@@ -2163,7 +2163,7 @@ def check_item_quality_inspection(doctype: str, docstatus: str | int, items: str
|
|||||||
|
|
||||||
inspection_fieldname = inspection_fieldname_map.get(doctype)
|
inspection_fieldname = inspection_fieldname_map.get(doctype)
|
||||||
if inspection_fieldname is None:
|
if inspection_fieldname is None:
|
||||||
return []
|
return items if doctype == "Stock Entry" else []
|
||||||
|
|
||||||
allow_after_transaction = cint(docstatus) == 1 and frappe.get_single_value(
|
allow_after_transaction = cint(docstatus) == 1 and frappe.get_single_value(
|
||||||
"Stock Settings", "allow_to_make_quality_inspection_after_purchase_or_delivery"
|
"Stock Settings", "allow_to_make_quality_inspection_after_purchase_or_delivery"
|
||||||
|
|||||||
@@ -389,11 +389,13 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const inspection_type = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"].includes(
|
const incoming_doctypes = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"];
|
||||||
this.frm.doc.doctype
|
const incoming_purposes = ["Manufacture", "Material Receipt"];
|
||||||
)
|
const inspection_type =
|
||||||
? "Incoming"
|
incoming_doctypes.includes(this.frm.doc.doctype) ||
|
||||||
: "Outgoing";
|
(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");
|
let quality_inspection_field = this.frm.get_docfield("items", "quality_inspection");
|
||||||
quality_inspection_field.get_route_options_for_new_doc = function (row) {
|
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 me = this;
|
||||||
const inspection_type = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"].includes(
|
const incoming_doctypes = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"];
|
||||||
this.frm.doc.doctype
|
const incoming_purposes = ["Manufacture", "Material Receipt"];
|
||||||
)
|
const inspection_type =
|
||||||
? "Incoming"
|
incoming_doctypes.includes(this.frm.doc.doctype) ||
|
||||||
: "Outgoing";
|
(this.frm.doc.doctype === "Stock Entry" && incoming_purposes.includes(this.frm.doc.purpose))
|
||||||
|
? "Incoming"
|
||||||
|
: "Outgoing";
|
||||||
const dialog = new frappe.ui.Dialog({
|
const dialog = new frappe.ui.Dialog({
|
||||||
title: __("Select Items for Quality Inspection"),
|
title: __("Select Items for Quality Inspection"),
|
||||||
size: "extra-large",
|
size: "extra-large",
|
||||||
|
|||||||
@@ -216,10 +216,11 @@ frappe.ui.form.on("Stock Entry", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let quality_inspection_field = frm.get_docfield("items", "quality_inspection");
|
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) {
|
quality_inspection_field.get_route_options_for_new_doc = function (row) {
|
||||||
if (frm.is_new()) return {};
|
if (frm.is_new()) return {};
|
||||||
return {
|
return {
|
||||||
inspection_type: "Incoming",
|
inspection_type: incoming_purposes.includes(frm.doc.purpose) ? "Incoming" : "Outgoing",
|
||||||
reference_type: frm.doc.doctype,
|
reference_type: frm.doc.doctype,
|
||||||
reference_name: frm.doc.name,
|
reference_name: frm.doc.name,
|
||||||
child_row_reference: row.doc.name,
|
child_row_reference: row.doc.name,
|
||||||
|
|||||||
@@ -259,7 +259,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"depends_on": "eval: doc.purpose === \"Manufacture\"",
|
|
||||||
"fieldname": "inspection_required",
|
"fieldname": "inspection_required",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Inspection Required"
|
"label": "Inspection Required"
|
||||||
@@ -769,7 +768,11 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
|
<<<<<<< HEAD
|
||||||
"modified": "2026-03-04 19:03:23.426082",
|
"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",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Stock Entry",
|
"name": "Stock Entry",
|
||||||
|
|||||||
Reference in New Issue
Block a user