mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +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:
@@ -1565,7 +1565,30 @@ def repost_required_for_queue(doc: StockController) -> bool:
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
<<<<<<< HEAD
|
||||
def make_quality_inspections(doctype, docname, items):
|
||||
=======
|
||||
def check_item_quality_inspection(doctype, items):
|
||||
if isinstance(items, str):
|
||||
items = json.loads(items)
|
||||
|
||||
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",
|
||||
}
|
||||
|
||||
for item in items:
|
||||
if not frappe.db.get_value("Item", item.get("item_code"), inspection_fieldname_map.get(doctype)):
|
||||
items.remove(item)
|
||||
return items
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_quality_inspections(doctype, docname, items, inspection_type):
|
||||
>>>>>>> c92ec312b9 (fix: show only items with inspection enabled on create QI dialog)
|
||||
if isinstance(items, str):
|
||||
items = json.loads(items)
|
||||
|
||||
|
||||
@@ -2367,8 +2367,16 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
primary_action_label: __("Create")
|
||||
});
|
||||
|
||||
this.frm.doc.items.forEach(item => {
|
||||
if (this.has_inspection_required(item)) {
|
||||
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,
|
||||
@@ -2391,6 +2399,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
has_inspection_required(item) {
|
||||
if (this.frm.doc.doctype === "Stock Entry" && this.frm.doc.purpose == "Manufacture" ) {
|
||||
|
||||
Reference in New Issue
Block a user