fix: support quality inspection for stock entry by purpose

Fetch QI items by warehouse direction per inspection_type, require QI on
the correct rows per stock entry purpose (finished good for Manufacture,
inward goods for Receipt/Repack, outgoing rows for issue/transfer), and
show the QI field only on those rows.
This commit is contained in:
Sudharsanan11
2026-06-25 11:51:00 +05:30
parent ead694c9cb
commit 2373db06ec
5 changed files with 59 additions and 18 deletions

View File

@@ -405,7 +405,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
}
const incoming_doctypes = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"];
const incoming_purposes = ["Manufacture", "Material Receipt"];
const incoming_purposes = ["Manufacture", "Material Receipt", "Repack"];
const inspection_type =
incoming_doctypes.includes(this.frm.doc.doctype) ||
(this.frm.doc.doctype === "Stock Entry" && incoming_purposes.includes(this.frm.doc.purpose))
@@ -2967,7 +2967,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
const me = this;
const incoming_doctypes = ["Purchase Receipt", "Purchase Invoice", "Subcontracting Receipt"];
const incoming_purposes = ["Manufacture", "Material Receipt"];
const incoming_purposes = ["Manufacture", "Material Receipt", "Repack"];
const inspection_type =
incoming_doctypes.includes(this.frm.doc.doctype) ||
(this.frm.doc.doctype === "Stock Entry" && incoming_purposes.includes(this.frm.doc.purpose))
@@ -3065,13 +3065,20 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
}
has_inspection_required(item) {
if (this.frm.doc.doctype === "Stock Entry" && this.frm.doc.purpose == "Manufacture") {
if (item.is_finished_item && !item.quality_inspection) {
return true;
}
} else if (!item.quality_inspection) {
if (item.quality_inspection) {
return false;
}
if (this.frm.doc.doctype !== "Stock Entry") {
return true;
}
const purpose = this.frm.doc.purpose;
if (purpose === "Manufacture") {
return !!item.is_finished_item;
}
if (["Material Receipt", "Repack"].includes(purpose)) {
return !!item.t_warehouse;
}
return !!item.s_warehouse && item.s_warehouse !== item.t_warehouse;
}
get_method_for_payment() {