Cleanup and fixes in quality inspection feature
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index ee25272..bf2e43d 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -32,11 +32,7 @@
if(doc.update_stock==1 && doc.docstatus==1) {
this.show_stock_ledger();
}
-
- if (doc.update_stock==1){
- this.setup_quality_inspection("Incoming");
- }
-
+
if(!doc.is_return && doc.docstatus==1) {
if(doc.outstanding_amount != 0) {
this.frm.add_custom_button(__('Payment'), this.make_payment_entry, __("Make"));
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index a8ffb20..5c2b62c 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -67,10 +67,6 @@
self.create_remarks()
self.set_status()
- #validate the quality inspection
- if self.update_stock==1:
- self.validate_inspection("inspection_required")
-
def validate_cash(self):
if not self.cash_bank_account and flt(self.paid_amount):
frappe.throw(_("Cash or Bank Account is mandatory for making payment entry"))
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
index ddd2d48..6f8e219 100755
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
@@ -1003,6 +1003,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "eval:!doc.__islocal",
"fieldname": "quality_inspection",
"fieldtype": "Link",
"hidden": 0,
@@ -1032,33 +1033,6 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "column_break_36",
- "fieldtype": "Column Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
"fieldname": "batch_no",
"fieldtype": "Link",
"hidden": 0,
@@ -1814,7 +1788,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-11-11 05:26:47.383600",
+ "modified": "2016-11-16 16:04:52.465169",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
index 7be5a24..944230b 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -23,6 +23,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Barcode",
"length": 0,
"no_copy": 0,
@@ -30,6 +31,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -48,6 +50,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Item",
"length": 0,
"no_copy": 0,
@@ -58,6 +61,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
@@ -76,12 +80,14 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -100,6 +106,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Item Name",
"length": 0,
"no_copy": 0,
@@ -109,6 +116,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@@ -127,6 +135,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Customer's Item Code",
"length": 0,
"no_copy": 0,
@@ -134,6 +143,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -152,6 +162,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Edit Description",
"length": 0,
"no_copy": 0,
@@ -160,6 +171,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -178,6 +190,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@@ -188,6 +201,7 @@
"print_hide_if_no_value": 0,
"print_width": "200px",
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@@ -207,6 +221,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -214,6 +229,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -232,6 +248,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Image View",
"length": 0,
"no_copy": 0,
@@ -241,6 +258,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -259,6 +277,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Image",
"length": 0,
"no_copy": 0,
@@ -267,6 +286,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -285,6 +305,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "",
"length": 0,
"no_copy": 0,
@@ -292,6 +313,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -310,6 +332,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Quantity",
"length": 0,
"no_copy": 0,
@@ -319,6 +342,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -337,6 +361,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Price List Rate",
"length": 0,
"no_copy": 0,
@@ -347,6 +372,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -365,12 +391,14 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -389,6 +417,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "UOM",
"length": 0,
"no_copy": 0,
@@ -397,6 +426,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -415,6 +445,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Price List Rate (Company Currency)",
"length": 0,
"no_copy": 0,
@@ -425,6 +456,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -443,6 +475,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Discount and Margin",
"length": 0,
"no_copy": 0,
@@ -451,6 +484,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -470,6 +504,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Discount on Price List Rate (%)",
"length": 0,
"no_copy": 0,
@@ -479,6 +514,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -497,6 +533,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -504,6 +541,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -523,6 +561,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Margin Type",
"length": 0,
"no_copy": 0,
@@ -532,6 +571,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -551,6 +591,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Margin Rate or Amount",
"length": 0,
"no_copy": 0,
@@ -559,6 +600,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -578,6 +620,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Total Margin",
"length": 0,
"no_copy": 0,
@@ -586,6 +629,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -604,12 +648,14 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -628,6 +674,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Rate",
"length": 0,
"no_copy": 0,
@@ -638,6 +685,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@@ -656,6 +704,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Amount",
"length": 0,
"no_copy": 0,
@@ -666,6 +715,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@@ -684,12 +734,14 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -708,6 +760,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Rate (Company Currency)",
"length": 0,
"no_copy": 0,
@@ -718,6 +771,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@@ -736,6 +790,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Amount (Company Currency)",
"length": 0,
"no_copy": 0,
@@ -746,6 +801,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@@ -764,6 +820,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Pricing Rule",
"length": 0,
"no_copy": 0,
@@ -772,6 +829,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -790,6 +848,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -797,6 +856,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -815,6 +875,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Net Rate",
"length": 0,
"no_copy": 0,
@@ -824,6 +885,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -842,6 +904,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Net Amount",
"length": 0,
"no_copy": 0,
@@ -851,6 +914,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -869,6 +933,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -876,6 +941,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -894,6 +960,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Net Rate (Company Currency)",
"length": 0,
"no_copy": 0,
@@ -903,6 +970,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -921,6 +989,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Net Amount (Company Currency)",
"length": 0,
"no_copy": 0,
@@ -930,6 +999,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -949,6 +1019,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Drop Ship",
"length": 0,
"no_copy": 0,
@@ -957,6 +1028,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -975,6 +1047,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Delivered By Supplier",
"length": 0,
"no_copy": 0,
@@ -983,6 +1056,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1001,6 +1075,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Accounting Details",
"length": 0,
"no_copy": 0,
@@ -1008,6 +1083,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1026,6 +1102,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Income Account",
"length": 0,
"no_copy": 0,
@@ -1037,6 +1114,7 @@
"print_hide_if_no_value": 0,
"print_width": "120px",
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@@ -1056,6 +1134,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Expense Account",
"length": 0,
"no_copy": 0,
@@ -1064,6 +1143,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1083,12 +1163,14 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1108,6 +1190,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Cost Center",
"length": 0,
"no_copy": 0,
@@ -1119,6 +1202,7 @@
"print_hide_if_no_value": 0,
"print_width": "120px",
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@@ -1139,6 +1223,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Stock Details",
"length": 0,
"no_copy": 0,
@@ -1146,6 +1231,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1164,6 +1250,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Warehouse",
"length": 0,
"no_copy": 0,
@@ -1174,6 +1261,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1192,6 +1280,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Customer Warehouse (Optional)",
"length": 0,
"no_copy": 1,
@@ -1201,6 +1290,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1212,22 +1302,25 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "serial_no",
- "fieldtype": "Small Text",
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "quality_inspection",
+ "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
- "in_filter": 1,
- "in_list_view": 1,
- "label": "Serial No",
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Quality Inspection",
"length": 0,
"no_copy": 0,
- "oldfieldname": "serial_no",
- "oldfieldtype": "Small Text",
+ "options": "Quality Inspection",
"permlevel": 0,
+ "precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1246,6 +1339,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Batch No",
"length": 0,
"no_copy": 0,
@@ -1254,6 +1348,62 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "col_break5",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "serial_no",
+ "fieldtype": "Small Text",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 1,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Serial No",
+ "length": 0,
+ "no_copy": 0,
+ "oldfieldname": "serial_no",
+ "oldfieldtype": "Small Text",
+ "permlevel": 0,
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1273,6 +1423,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Item Group",
"length": 0,
"no_copy": 0,
@@ -1283,6 +1434,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1301,6 +1453,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Brand Name",
"length": 0,
"no_copy": 0,
@@ -1310,6 +1463,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1328,6 +1482,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Item Tax Rate",
"length": 0,
"no_copy": 0,
@@ -1337,30 +1492,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "col_break5",
- "fieldtype": "Column Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 0,
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1379,6 +1511,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Available Batch Qty at Warehouse",
"length": 0,
"no_copy": 1,
@@ -1388,6 +1521,7 @@
"print_hide_if_no_value": 0,
"print_width": "150px",
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1407,6 +1541,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Available Qty at Warehouse",
"length": 0,
"no_copy": 0,
@@ -1416,6 +1551,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1434,6 +1570,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "References",
"length": 0,
"no_copy": 0,
@@ -1442,6 +1579,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1460,6 +1598,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Sales Order",
"length": 0,
"no_copy": 1,
@@ -1470,6 +1609,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
@@ -1488,6 +1628,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Sales Order Item",
"length": 0,
"no_copy": 1,
@@ -1497,6 +1638,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
@@ -1515,6 +1657,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -1522,6 +1665,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1540,6 +1684,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Delivery Note",
"length": 0,
"no_copy": 1,
@@ -1550,6 +1695,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
@@ -1568,6 +1714,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Delivery Note Item",
"length": 0,
"no_copy": 1,
@@ -1577,6 +1724,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
@@ -1595,6 +1743,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Delivered Qty",
"length": 0,
"no_copy": 0,
@@ -1604,6 +1753,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1622,6 +1772,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Is Fixed Asset",
"length": 0,
"no_copy": 1,
@@ -1630,6 +1781,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1648,6 +1800,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Asset",
"length": 0,
"no_copy": 1,
@@ -1657,6 +1810,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1675,6 +1829,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -1682,6 +1837,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -1700,6 +1856,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Page Break",
"length": 0,
"no_copy": 1,
@@ -1707,6 +1864,7 @@
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
@@ -1724,7 +1882,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-11-01 13:01:58.844818",
+ "modified": "2016-11-16 16:04:02.438952",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index bf3ba6f..631685e 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -11,6 +11,10 @@
from erpnext.controllers.accounts_controller import AccountsController
class StockController(AccountsController):
+ def validate(self):
+ super(StockController, self).validate()
+ self.validate_inspection()
+
def make_gl_entries(self, repost_future_gle=True):
if self.docstatus == 2:
delete_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
@@ -254,18 +258,27 @@
"name": self.name,
}, update_modified)
- def validate_inspection(self, inspection_type):
+ def validate_inspection(self):
'''Checks if quality inspection is set for Items that require inspection.
On submit, throw an exception'''
+
+ if self.doctype in ["Purchase Receipt", "Purchase Invoice"]:
+ inspection_required_fieldname = "inspection_required_before_purchase"
+ elif self.doctype in ["Delivery Note", "Sales Invoice"]:
+ inspection_required_fieldname = "inspection_required_before_delivery"
+
+ if not inspection_required_fieldname or \
+ (self.doctype in ["Sales Invoice", "Purchase Invoice"] and not self.update_stock):
+ return
+
for d in self.get('items'):
- if (frappe.db.get_value("Item", d.item_code, inspection_type)
+ if (frappe.db.get_value("Item", d.item_code, inspection_required_fieldname)
and not d.quality_inspection):
+
frappe.msgprint(_("Quality Inspection required for Item {0}").format(d.item_code))
if self.docstatus==1:
raise frappe.ValidationError
-
-
def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for_items=None,
warehouse_account=None):
def _delete_gl_entries(voucher_type, voucher_no):
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 03ad708..28db695 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -349,4 +349,5 @@
erpnext.patches.v7_0.set_base_amount_in_invoice_payment_table
erpnext.patches.v7_1.update_invoice_status
erpnext.patches.v7_0.po_status_issue_for_pr_return
-erpnext.patches.v7_1.update_missing_salary_component_type
\ No newline at end of file
+erpnext.patches.v7_1.update_missing_salary_component_type
+erpnext.patches.v7_1.rename_quality_inspection_field
\ No newline at end of file
diff --git a/erpnext/patches/v7_1/rename_quality_inspection_field.py b/erpnext/patches/v7_1/rename_quality_inspection_field.py
new file mode 100644
index 0000000..25f432c
--- /dev/null
+++ b/erpnext/patches/v7_1/rename_quality_inspection_field.py
@@ -0,0 +1,39 @@
+from __future__ import unicode_literals
+import frappe
+from frappe.model.utils.rename_field import *
+
+def execute():
+ for doctype in ("Purchase Receipt Item", "Delivery Note Item"):
+ frappe.reload_doctype(doctype)
+
+ table_columns = frappe.db.get_table_columns(doctype)
+ if "qa_no" in table_columns:
+ rename_field(doctype, "qa_no", "quality_inspection")
+
+ frappe.reload_doctype("Item")
+ rename_field("Item", "inspection_required", "inspection_required_before_purchase")
+
+ frappe.reload_doctype("Quality Inspection")
+ frappe.db.sql("""
+ update
+ `tabQuality Inspection`
+ set
+ reference_type = 'Purchase Receipt', reference_name = purchase_receipt_no
+ where
+ ifnull(purchase_receipt_no, '') != '' and inspection_type = 'Incoming'
+ """)
+
+ frappe.db.sql("""
+ update
+ `tabQuality Inspection`
+ set
+ reference_type = 'Delivery Note', reference_name = delivery_note_no
+ where
+ ifnull(delivery_note_no, '') != '' and inspection_type = 'Outgoing'
+ """)
+
+ for old_fieldname in ["purchase_receipt_no", "delivery_note_no"]:
+ update_reports("Quality Inspection", old_fieldname, "reference_name")
+ update_users_report_view_settings("Quality Inspection", old_fieldname, "reference_name")
+ update_property_setters("Quality Inspection", old_fieldname, "reference_name")
+
\ No newline at end of file
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 53a489c..b529f0f 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -79,7 +79,6 @@
frm.cscript.calculate_taxes_and_totals();
});
-
},
onload: function() {
var me = this;
@@ -135,24 +134,32 @@
}
});
}
+
+ this.setup_quality_inspection();
},
- setup_quality_inspection: function(inspection_type) {
+ setup_quality_inspection: function() {
+ if(!in_list(["Delivery Note", "Sales Invoice", "Purchase Receipt", "Purchase Invoice"], this.frm.doc.doctype)) {
+ return;
+ }
var me = this;
+ var inspection_type = in_list(["Purchase Receipt", "Purchase Invoice"], this.frm.doc.doctype)
+ ? "Incoming" : "Outgoing";
+
var quality_inspection_field = this.frm.get_docfield("items", "quality_inspection");
- quality_inspection_field.get_route_options_for_new_doc = function(field) {
+ quality_inspection_field.get_route_options_for_new_doc = function(row) {
if(me.frm.is_new()) return;
- var doc = field.doc;
return {
"inspection_type": inspection_type,
"reference_type": me.frm.doc.doctype,
"reference_name": me.frm.doc.name,
- "item_code": doc.item_code,
- "description": doc.description,
- "item_serial_no": doc.serial_no ? doc.serial_no.split("\n")[0] : null,
- "batch_no": doc.batch_no
+ "item_code": row.doc.item_code,
+ "description": row.doc.description,
+ "item_serial_no": row.doc.serial_no ? row.doc.serial_no.split("\n")[0] : null,
+ "batch_no": row.doc.batch_no
}
}
+
this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return {
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js
index baeb069..204e98a 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.js
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.js
@@ -8,7 +8,6 @@
frappe.ui.form.on("Delivery Note", {
setup: function(frm) {
-
frm.set_indicator_formatter('item_code',
function(doc) {
return (doc.docstatus==1 || doc.qty<=doc.actual_qty) ? "green" : "orange"
@@ -27,11 +26,6 @@
});
erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend({
- onload: function() {
- this._super();
- this.setup_quality_inspection("Outgoing");
- },
-
refresh: function(doc, dt, dn) {
this._super();
if (!doc.is_return && doc.status!="Closed") {
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 64a484a..5e31ac3 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -103,7 +103,6 @@
self.validate_warehouse()
self.validate_uom_is_integer("stock_uom", "qty")
self.validate_with_previous_doc()
- self.validate_inspection("inspection_required_before_delivery")
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
make_packing_list(self)
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index 4653c8f..9b83cf2 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -1126,6 +1126,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "eval:!doc.__islocal",
"fieldname": "quality_inspection",
"fieldtype": "Link",
"hidden": 0,
@@ -1690,7 +1691,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-11-10 01:46:39.079270",
+ "modified": "2016-11-16 16:05:03.945501",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index 4c0dda8..67529f1 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -2009,7 +2009,7 @@
"collapsible": 0,
"columns": 0,
"default": "",
- "fieldname": "inspection_required",
+ "fieldname": "inspection_required_before_purchase",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
@@ -2683,7 +2683,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
- "modified": "2016-11-07 06:20:15.118045",
+ "modified": "2016-11-16 15:57:09.941178",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
index 58d9060..457a7c2 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -31,10 +31,6 @@
});
erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({
- onload: function() {
- this._super();
- this.setup_quality_inspection("Incoming");
- },
refresh: function() {
this._super();
if(this.frm.doc.docstatus===1) {
@@ -180,14 +176,6 @@
}
}
-cur_frm.fields_dict.items.grid.get_field("quality_inspection").get_query = function(doc) {
- return {
- filters: {
- 'docstatus': 1
- }
- }
-}
-
cur_frm.fields_dict['items'].grid.get_field('bom').get_query = function(doc, cdt, cdn) {
var d = locals[cdt][cdn]
return {
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 8dabea2..4bcde6a 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -52,7 +52,6 @@
self.set_status()
self.po_required()
self.validate_with_previous_doc()
- self.validate_inspection("inspection_required")
self.validate_uom_is_integer("uom", ["qty", "received_qty"])
self.validate_uom_is_integer("stock_uom", "stock_qty")
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
index 8ee1dde..d8449f1 100755
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
@@ -1146,6 +1146,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "eval:!doc.__islocal",
"fieldname": "quality_inspection",
"fieldtype": "Link",
"hidden": 0,
@@ -1884,7 +1885,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-11-10 01:49:10.080408",
+ "modified": "2016-11-16 16:04:21.778869",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.js b/erpnext/stock/doctype/quality_inspection/quality_inspection.js
index e85e1f8..5d7b6b4 100644
--- a/erpnext/stock/doctype/quality_inspection/quality_inspection.js
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.js
@@ -5,20 +5,12 @@
// item code based on GRN/DN
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
- if (doc.purchase_receipt) {
+ if (doc.reference_type && doc.reference_name) {
return {
query: "erpnext.stock.doctype.quality_inspection.quality_inspection.item_query",
filters: {
- "from": "Purchase Receipt Item",
- "parent": doc.purchase_receipt
- }
- }
- } else if(doc.delivery_note) {
- return {
- query: "erpnext.stock.doctype.quality_inspection.quality_inspection.item_query",
- filters: {
- "from": "Delivery Note Item",
- "parent": doc.delivery_note
+ "from": doc.reference_type,
+ "parent": doc.reference_name
}
}
}
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
index 750db06..3ba3056 100644
--- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
@@ -24,30 +24,20 @@
child.status = 'Accepted'
def on_submit(self):
- if self.purchase_receipt:
- frappe.db.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2
+ if self.reference_type and self.reference_name:
+ frappe.db.sql("""update `tab{doctype} Item` t1, `tab{doctype}` t2
set t1.quality_inspection = %s, t2.modified = %s
- where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name""",
- (self.name, self.modified, self.purchase_receipt_no,
- self.item_code))
- if self.delivery_note:
- frappe.db.sql("""update `tabDelivery Note Item` t1, `tabDelivery Note` t2
- set t1.quality_inspection = %s, t2.modified = %s
- where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name""",
- (self.name, self.modified, self.delivery_note_no,
- self.item_code))
-
+ where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name"""
+ .format(doctype=self.reference_type),
+ (self.name, self.modified, self.reference_name, self.item_code))
+
def on_cancel(self):
- if self.purchase_receipt:
- frappe.db.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2
- set t1.quality_inspection = '', t2.modified = %s
- where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name""",
- (self.modified, self.purchase_receipt_no, self.item_code))
- if self.delivery_note:
- frappe.db.sql("""update `tabDelivery Note Item` t1, `tabDelivery Note` t2
- set t1.quality_inspection = '', t2.modified = %s
- where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name""",
- (self.modified, self.delivery_note_no, self.item_code))
+ if self.reference_type and self.reference_name:
+ frappe.db.sql("""update `tab{doctype} Item` t1, `tab{doctype}` t2
+ set t1.quality_inspection = null, t2.modified = %s
+ where t1.parent = %s and t1.item_code = %s and t1.parent = t2.name"""
+ .format(doctype=self.reference_type),
+ (self.modified, self.reference_name, self.item_code))
def item_query(doctype, txt, searchfield, start, page_len, filters):
if filters.get("from"):