mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
fix: show only items with inspection enabled on create QI dialog
(cherry picked from commit c92ec312b9)
# Conflicts:
# erpnext/controllers/stock_controller.py
This commit is contained in:
@@ -2367,29 +2367,39 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
primary_action_label: __("Create")
|
||||
});
|
||||
|
||||
this.frm.doc.items.forEach(item => {
|
||||
if (this.has_inspection_required(item)) {
|
||||
let dialog_items = dialog.fields_dict.items;
|
||||
dialog_items.df.data.push({
|
||||
"item_code": item.item_code,
|
||||
"item_name": item.item_name,
|
||||
"qty": item.qty,
|
||||
"description": item.description,
|
||||
"serial_no": item.serial_no,
|
||||
"batch_no": item.batch_no,
|
||||
"sample_size": item.sample_quantity,
|
||||
"child_row_reference": item.name,
|
||||
frappe.call({
|
||||
method: "erpnext.controllers.stock_controller.check_item_quality_inspection",
|
||||
args: {
|
||||
doctype: this.frm.doc.doctype,
|
||||
items: this.frm.doc.items
|
||||
},
|
||||
freeze: true,
|
||||
callback: function (r) {
|
||||
r.message.forEach(item => {
|
||||
if (me.has_inspection_required(item)) {
|
||||
let dialog_items = dialog.fields_dict.items;
|
||||
dialog_items.df.data.push({
|
||||
"item_code": item.item_code,
|
||||
"item_name": item.item_name,
|
||||
"qty": item.qty,
|
||||
"description": item.description,
|
||||
"serial_no": item.serial_no,
|
||||
"batch_no": item.batch_no,
|
||||
"sample_size": item.sample_quantity,
|
||||
"child_row_reference": item.name,
|
||||
});
|
||||
dialog_items.grid.refresh();
|
||||
}
|
||||
});
|
||||
dialog_items.grid.refresh();
|
||||
|
||||
data = dialog.fields_dict.items.df.data;
|
||||
if (!data.length) {
|
||||
frappe.msgprint(__("All items in this document already have a linked Quality Inspection."));
|
||||
} else {
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
data = dialog.fields_dict.items.df.data;
|
||||
if (!data.length) {
|
||||
frappe.msgprint(__("All items in this document already have a linked Quality Inspection."));
|
||||
} else {
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
has_inspection_required(item) {
|
||||
|
||||
Reference in New Issue
Block a user