From cc90241fa50287981750853ae86377d334904ed2 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Thu, 10 Nov 2016 19:15:11 +0530 Subject: [PATCH 1/9] Quality Inspection Issue 1. validate_inspection() function defination in stock_controller.py 2. function call in purchase_receipt.py, purchase_invoice.py and delivery_note.py 3. added functality in quality_inspection.py file for linking to purchase_receipt_no and delivery_note_no --- .../purchase_invoice/purchase_invoice.py | 4 + .../purchase_invoice_item.json | 180 +++++++++++++++++- .../quality_inspection/quality_inspection.js | 2 +- .../quality_inspection/quality_inspection.py | 15 +- erpnext/controllers/stock_controller.py | 12 ++ erpnext/public/js/controllers/transaction.js | 27 +++ .../doctype/delivery_note/delivery_note.js | 6 +- .../doctype/delivery_note/delivery_note.py | 9 +- .../delivery_note_item.json | 4 +- .../purchase_receipt/purchase_receipt.js | 29 ++- .../purchase_receipt/purchase_receipt.py | 9 +- .../purchase_receipt_dashboard.py | 2 +- .../purchase_receipt_item.json | 132 ++++++++++++- 13 files changed, 387 insertions(+), 44 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 5c2b62cd02..a8ffb203c3 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -67,6 +67,10 @@ class PurchaseInvoice(BuyingController): 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 d4e20f902f..70c6ba2378 100755 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json @@ -23,6 +23,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 1, + "in_standard_filter": 0, "label": "Item", "length": 0, "no_copy": 0, @@ -33,6 +34,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": 1, @@ -51,12 +53,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, @@ -75,6 +79,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Item Name", "length": 0, "no_copy": 0, @@ -84,6 +89,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, @@ -102,6 +108,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Description", "length": 0, "no_copy": 0, @@ -110,6 +117,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, @@ -128,6 +136,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Description", "length": 0, "no_copy": 0, @@ -138,6 +147,7 @@ "print_hide_if_no_value": 0, "print_width": "300px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -157,6 +167,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Image", "length": 0, "no_copy": 0, @@ -165,6 +176,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, @@ -183,6 +195,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Image View", "length": 0, "no_copy": 0, @@ -192,6 +205,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, @@ -210,6 +224,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Quantity and Rate", "length": 0, "no_copy": 0, @@ -217,6 +232,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, @@ -235,6 +251,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Received Qty", "length": 0, "no_copy": 0, @@ -243,6 +260,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, @@ -261,6 +279,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Qty", "length": 0, "no_copy": 0, @@ -270,6 +289,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, @@ -288,6 +308,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Rejected Qty", "length": 0, "no_copy": 0, @@ -296,6 +317,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, @@ -314,12 +336,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, @@ -338,6 +362,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "UOM", "length": 0, "no_copy": 0, @@ -346,6 +371,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, @@ -364,6 +390,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Conversion Factor", "length": 0, "no_copy": 0, @@ -371,6 +398,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, @@ -389,12 +417,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, @@ -413,6 +443,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, @@ -421,6 +452,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, @@ -440,6 +472,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, @@ -447,6 +480,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, @@ -465,12 +499,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, @@ -489,6 +525,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, @@ -497,6 +534,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, @@ -515,12 +553,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, @@ -539,6 +579,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Rate ", "length": 0, "no_copy": 0, @@ -549,6 +590,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, @@ -567,6 +609,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Amount", "length": 0, "no_copy": 0, @@ -577,6 +620,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, @@ -595,12 +639,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, @@ -619,6 +665,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, @@ -629,6 +676,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, @@ -647,6 +695,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, @@ -657,6 +706,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, @@ -675,6 +725,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Pricing Rule", "length": 0, "no_copy": 0, @@ -683,6 +734,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, @@ -701,6 +753,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -708,6 +761,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, @@ -726,6 +780,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Net Rate", "length": 0, "no_copy": 0, @@ -735,6 +790,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, @@ -753,6 +809,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Net Amount", "length": 0, "no_copy": 0, @@ -762,6 +819,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, @@ -780,6 +838,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -787,6 +846,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, @@ -805,6 +865,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, @@ -814,6 +875,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, @@ -832,6 +894,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, @@ -841,6 +904,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, @@ -859,6 +923,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Warehouse", "length": 0, "no_copy": 0, @@ -867,6 +932,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, @@ -886,6 +952,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Accepted Warehouse", "length": 0, "no_copy": 0, @@ -895,6 +962,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, @@ -913,6 +981,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Rejected Warehouse", "length": 0, "no_copy": 0, @@ -922,6 +991,63 @@ "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": "quality_inspection", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quality Inspection", + "length": 0, + "no_copy": 0, + "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, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "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, @@ -940,6 +1066,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Batch No", "length": 0, "no_copy": 0, @@ -949,6 +1076,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, @@ -967,6 +1095,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "", "length": 0, "no_copy": 0, @@ -975,6 +1104,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, @@ -993,6 +1123,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Serial No", "length": 0, "no_copy": 0, @@ -1001,6 +1132,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, @@ -1019,6 +1151,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Rejected Serial No", "length": 0, "no_copy": 1, @@ -1027,6 +1160,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, @@ -1045,6 +1179,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Accounting", "length": 0, "no_copy": 0, @@ -1052,6 +1187,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, @@ -1070,6 +1206,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Expense Head", "length": 0, "no_copy": 0, @@ -1081,6 +1218,7 @@ "print_hide_if_no_value": 0, "print_width": "120px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -1100,12 +1238,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, @@ -1124,6 +1264,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, + "in_standard_filter": 0, "label": "Project", "length": 0, "no_copy": 0, @@ -1132,6 +1273,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, @@ -1152,6 +1294,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Cost Center", "length": 0, "no_copy": 0, @@ -1163,6 +1306,7 @@ "print_hide_if_no_value": 0, "print_width": "120px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -1182,6 +1326,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Reference", "length": 0, "no_copy": 0, @@ -1189,6 +1334,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, @@ -1207,6 +1353,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Brand", "length": 0, "no_copy": 0, @@ -1216,6 +1363,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, @@ -1235,6 +1383,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, + "in_standard_filter": 0, "label": "Item Group", "length": 0, "no_copy": 0, @@ -1245,6 +1394,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, @@ -1264,6 +1414,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, @@ -1273,6 +1424,7 @@ "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 1, "reqd": 0, "search_index": 0, @@ -1291,6 +1443,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Item Tax Amount", "length": 0, "no_copy": 1, @@ -1300,6 +1453,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, @@ -1319,6 +1473,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, + "in_standard_filter": 0, "label": "Purchase Order", "length": 0, "no_copy": 1, @@ -1329,6 +1484,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, @@ -1347,6 +1503,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "BOM", "length": 0, "no_copy": 0, @@ -1356,6 +1513,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, @@ -1374,12 +1532,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, @@ -1398,6 +1558,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, @@ -1406,6 +1567,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, @@ -1425,6 +1587,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Asset", "length": 0, "no_copy": 1, @@ -1434,6 +1597,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, @@ -1452,6 +1616,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, + "in_standard_filter": 0, "label": "Purchase Order Item", "length": 0, "no_copy": 1, @@ -1461,6 +1626,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, @@ -1479,6 +1645,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, + "in_standard_filter": 0, "label": "Purchase Receipt", "length": 0, "no_copy": 1, @@ -1489,6 +1656,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, @@ -1507,6 +1675,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Page Break", "length": 0, "no_copy": 1, @@ -1514,6 +1683,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, @@ -1532,6 +1702,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, + "in_standard_filter": 0, "label": "PR Detail", "length": 0, "no_copy": 1, @@ -1541,6 +1712,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, @@ -1559,6 +1731,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Valuation Rate", "length": 0, "no_copy": 1, @@ -1567,6 +1740,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, @@ -1585,6 +1759,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Raw Materials Supplied Cost", "length": 0, "no_copy": 1, @@ -1593,6 +1768,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, @@ -1611,6 +1787,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Landed Cost Voucher Amount", "length": 0, "no_copy": 1, @@ -1619,6 +1796,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, @@ -1636,7 +1814,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-08-26 04:37:23.737537", + "modified": "2016-11-10 01:53:28.457971", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice Item", diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.js b/erpnext/buying/doctype/quality_inspection/quality_inspection.js index 628337b2c3..17bae36026 100644 --- a/erpnext/buying/doctype/quality_inspection/quality_inspection.js +++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.js @@ -33,7 +33,7 @@ cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { "parent": doc.purchase_receipt_no } } - } else if (doc.delivery_note_no) { + } else if(doc.delivery_note_no) { return { query: "erpnext.buying.doctype.quality_inspection.quality_inspection.item_query", filters: { diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.py b/erpnext/buying/doctype/quality_inspection/quality_inspection.py index d1d9518bc2..ba77d3a5a8 100644 --- a/erpnext/buying/doctype/quality_inspection/quality_inspection.py +++ b/erpnext/buying/doctype/quality_inspection/quality_inspection.py @@ -26,17 +26,28 @@ class QualityInspection(Document): def on_submit(self): if self.purchase_receipt_no: frappe.db.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 - set t1.qa_no = %s, t2.modified = %s + 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_no): + 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)) def on_cancel(self): if self.purchase_receipt_no: frappe.db.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 - set t1.qa_no = '', t2.modified = %s + 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_no): + 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)) def item_query(doctype, txt, searchfield, start, page_len, filters): if filters.get("from"): diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index e48ca1ace1..bf3ba6fe31 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -254,6 +254,18 @@ class StockController(AccountsController): "name": self.name, }, update_modified) + def validate_inspection(self, inspection_type): + '''Checks if quality inspection is set for Items that require inspection. + On submit, throw an exception''' + for d in self.get('items'): + if (frappe.db.get_value("Item", d.item_code, inspection_type) + 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/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index aa20e79e07..a301c96925 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1004,5 +1004,32 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ } return method + }, + + setup_quality_inspection: function(doctype_name, inspection_type) { + var quality_inspection = frappe.meta.get_docfield(doctype_name, "quality_inspection"); + quality_inspection.get_route_options_for_new_doc = function(field) { + if(frm.is_new()) return; + var doc = field.doc; + return { + "inspection_type": inspection_type, + "purchase_receipt_no": 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 + } + } + this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { + var d = locals[cdt][cdn]; + return { + filters: { + docstatus: 1, + inspection_type: inspection_type, + item_code: d.item_code + } + } + }); + } }); \ No newline at end of file diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 8f3792c0b4..2597280876 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -8,8 +8,8 @@ frappe.provide("erpnext.stock.delivery_note"); frappe.ui.form.on("Delivery Note", { setup: function(frm) { - var qa_no = frappe.meta.get_docfield("Delivery Note Item", "qa_no"); - qa_no.get_route_options_for_new_doc = function(field) { + var quality_inspection = frappe.meta.get_docfield("Delivery Note Item", "quality_inspection"); + quality_inspection.get_route_options_for_new_doc = function(field) { if(frm.is_new()) return; var doc = field.doc; return { @@ -36,7 +36,7 @@ frappe.ui.form.on("Delivery Note", { } }) - frm.set_query("qa_no", "items", function(doc, cdt, cdn) { + frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { var d = locals[cdt][cdn]; return { filters: { diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 54c40fa5b0..64a484aa9c 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -103,7 +103,7 @@ class DeliveryNote(SellingController): self.validate_warehouse() self.validate_uom_is_integer("stock_uom", "qty") self.validate_with_previous_doc() - self.validate_inspection() + self.validate_inspection("inspection_required_before_delivery") from erpnext.stock.doctype.packed_item.packed_item import make_packing_list make_packing_list(self) @@ -112,13 +112,6 @@ class DeliveryNote(SellingController): if not self.installation_status: self.installation_status = 'Not Installed' - def validate_inspection(self): - for d in self.get('items'): #Enter inspection date for all items that require inspection - if frappe.db.get_value("Item", d.item_code, "inspection_required_before_delivery") and not d.qa_no: - frappe.msgprint(_("Quality Inspection required for Item {0}").format(d.item_code)) - if self.docstatus==1: - raise frappe.ValidationError - def validate_with_previous_doc(self): for fn in (("Sales Order", "against_sales_order", "so_detail"), ("Sales Invoice", "against_sales_invoice", "si_detail")): 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 69f195f740..4653c8ff31 100644 --- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json +++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json @@ -1126,7 +1126,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "qa_no", + "fieldname": "quality_inspection", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -1690,7 +1690,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-11-03 13:25:38.928043", + "modified": "2016-11-10 01:46:39.079270", "modified_by": "Administrator", "module": "Stock", "name": "Delivery Note Item", diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 0225af3673..526a109391 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -7,8 +7,9 @@ frappe.provide("erpnext.stock"); frappe.ui.form.on("Purchase Receipt", { onload: function(frm) { - var qa_no = frappe.meta.get_docfield("Purchase Receipt Item", "qa_no"); - qa_no.get_route_options_for_new_doc = function(field) { + console.log('onload1'); + var quality_inspection = frappe.meta.get_docfield("Purchase Receipt Item", "quality_inspection"); + quality_inspection.get_route_options_for_new_doc = function(field) { if(frm.is_new()) return; var doc = field.doc; return { @@ -20,7 +21,7 @@ frappe.ui.form.on("Purchase Receipt", { "batch_no": doc.batch_no } } - + console.log(quality_inspection); $.each(["warehouse", "rejected_warehouse"], function(i, field) { frm.set_query(field, "items", function() { return { @@ -39,22 +40,18 @@ frappe.ui.form.on("Purchase Receipt", { ["Warehouse", "is_group", "=", 0] ] } - }) - - frm.set_query("qa_no", "items", function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - return { - filters: { - docstatus: 1, - inspection_type: "Incoming", - item_code: d.item_code - } - } - }) + }); + } }); erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({ + onload: function() { + this._super(); + console.log(' before onload2'); + //this.setup_inspection_required_filter('Incoming'); + this.setup_quality_inspection("Purchase Receipt Item","Incoming") + }, refresh: function() { this._super(); if(this.frm.doc.docstatus===1) { @@ -200,7 +197,7 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) } } -cur_frm.fields_dict.items.grid.get_field("qa_no").get_query = function(doc) { +cur_frm.fields_dict.items.grid.get_field("quality_inspection").get_query = function(doc) { return { filters: { 'docstatus': 1 diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py index 86fb88b9c7..8dabea2525 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -52,7 +52,7 @@ class PurchaseReceipt(BuyingController): self.set_status() self.po_required() self.validate_with_previous_doc() - self.validate_inspection() + self.validate_inspection("inspection_required") self.validate_uom_is_integer("uom", ["qty", "received_qty"]) self.validate_uom_is_integer("stock_uom", "stock_qty") @@ -97,13 +97,6 @@ class PurchaseReceipt(BuyingController): ["qty", "warehouse"]) return po_qty, po_warehouse - def validate_inspection(self): - for d in self.get('items'): #Enter inspection date for all items that require inspection - if frappe.db.get_value("Item", d.item_code, "inspection_required") and not d.qa_no: - frappe.msgprint(_("Quality Inspection required for Item {0}").format(d.item_code)) - if self.docstatus==1: - raise frappe.ValidationError - # Check for Closed status def check_for_closed_status(self, pc_obj): check_list =[] diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py index 7059c91813..9722d8791f 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py @@ -10,7 +10,7 @@ def get_data(): 'internal_links': { 'Purchase Order': ['items', 'purchase_order'], 'Project': ['items', 'project'], - 'Quality Inspection': ['items', 'qa_no'], + 'Quality Inspection': ['items', 'quality_inspection'], }, 'transactions': [ { 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 f6e1e3f870..8ee1dde6ee 100755 --- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json +++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_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, @@ -31,6 +32,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, @@ -49,6 +51,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -56,6 +59,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, @@ -74,6 +78,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 1, + "in_standard_filter": 0, "label": "Item Code", "length": 0, "no_copy": 0, @@ -85,6 +90,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 1, @@ -104,6 +110,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -111,6 +118,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, @@ -129,6 +137,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Item Name", "length": 0, "no_copy": 0, @@ -138,6 +147,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, @@ -156,6 +166,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Description", "length": 0, "no_copy": 0, @@ -164,6 +175,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, @@ -182,6 +194,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Description", "length": 0, "no_copy": 0, @@ -192,6 +205,7 @@ "print_hide_if_no_value": 0, "print_width": "300px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -211,12 +225,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, @@ -235,6 +251,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Image", "length": 0, "no_copy": 0, @@ -243,6 +260,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, @@ -261,6 +279,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Image View", "length": 0, "no_copy": 0, @@ -270,6 +289,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, @@ -288,6 +308,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Received and Accepted", "length": 0, "no_copy": 0, @@ -295,6 +316,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, @@ -313,6 +335,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Recd Quantity", "length": 0, "no_copy": 0, @@ -323,6 +346,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -342,6 +366,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Accepted Quantity", "length": 0, "no_copy": 0, @@ -352,6 +377,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -371,6 +397,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Rejected Quantity", "length": 0, "no_copy": 0, @@ -381,6 +408,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -400,12 +428,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, @@ -424,6 +454,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "UOM", "length": 0, "no_copy": 0, @@ -435,6 +466,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -454,6 +486,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Stock UOM", "length": 0, "no_copy": 0, @@ -465,6 +498,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -484,6 +518,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Conversion Factor", "length": 0, "no_copy": 0, @@ -494,6 +529,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -513,6 +549,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Rate and Amount", "length": 0, "no_copy": 0, @@ -520,6 +557,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, @@ -538,6 +576,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, @@ -546,6 +585,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, @@ -565,6 +605,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, @@ -572,6 +613,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, @@ -590,12 +632,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, @@ -614,6 +658,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, @@ -622,6 +667,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, @@ -640,12 +686,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, @@ -664,6 +712,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Rate", "length": 0, "no_copy": 0, @@ -675,6 +724,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -694,6 +744,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Amount", "length": 0, "no_copy": 0, @@ -704,6 +755,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, @@ -722,12 +774,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, @@ -746,6 +800,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, @@ -757,6 +812,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 1, "search_index": 0, @@ -776,6 +832,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, @@ -787,6 +844,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -806,6 +864,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Pricing Rule", "length": 0, "no_copy": 0, @@ -814,6 +873,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, @@ -832,6 +892,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -839,6 +900,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, @@ -857,6 +919,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Net Rate", "length": 0, "no_copy": 0, @@ -866,6 +929,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, @@ -884,6 +948,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Net Amount", "length": 0, "no_copy": 0, @@ -893,6 +958,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, @@ -911,6 +977,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -918,6 +985,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, @@ -936,6 +1004,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, @@ -945,6 +1014,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, @@ -963,6 +1033,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, @@ -972,6 +1043,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, @@ -990,6 +1062,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Warehouse and Reference", "length": 0, "no_copy": 0, @@ -997,6 +1070,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, @@ -1015,6 +1089,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Accepted Warehouse", "length": 0, "no_copy": 0, @@ -1026,6 +1101,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -1045,6 +1121,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Rejected Warehouse", "length": 0, "no_copy": 1, @@ -1056,6 +1133,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 0, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -1068,13 +1146,14 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "qa_no", + "fieldname": "quality_inspection", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Quality Inspection", "length": 0, "no_copy": 1, @@ -1085,6 +1164,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, @@ -1103,6 +1183,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -1110,6 +1191,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, @@ -1128,6 +1210,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, + "in_standard_filter": 0, "label": "Purchase Order", "length": 0, "no_copy": 1, @@ -1139,6 +1222,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": 1, @@ -1158,6 +1242,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Required By", "length": 0, "no_copy": 0, @@ -1167,6 +1252,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, @@ -1185,6 +1271,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Qty as per Stock UOM", "length": 0, "no_copy": 0, @@ -1195,6 +1282,7 @@ "print_hide_if_no_value": 0, "print_width": "100px", "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -1214,6 +1302,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -1221,6 +1310,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, @@ -1239,6 +1329,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 1, + "in_standard_filter": 0, "label": "Serial No", "length": 0, "no_copy": 1, @@ -1248,6 +1339,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, @@ -1266,6 +1358,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 1, + "in_standard_filter": 0, "label": "Batch No", "length": 0, "no_copy": 0, @@ -1276,6 +1369,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, @@ -1294,6 +1388,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "", "length": 0, "no_copy": 0, @@ -1302,6 +1397,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, @@ -1320,6 +1416,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Rejected Serial No", "length": 0, "no_copy": 1, @@ -1327,6 +1424,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, @@ -1345,6 +1443,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "length": 0, "no_copy": 0, "permlevel": 0, @@ -1352,6 +1451,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, @@ -1370,6 +1470,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, + "in_standard_filter": 0, "label": "Project", "length": 0, "no_copy": 0, @@ -1378,6 +1479,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, @@ -1398,6 +1500,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Cost Center", "length": 0, "no_copy": 0, @@ -1406,6 +1509,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, @@ -1424,6 +1528,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, + "in_standard_filter": 0, "label": "Purchase Order Item", "length": 0, "no_copy": 1, @@ -1434,6 +1539,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": 1, @@ -1453,12 +1559,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, @@ -1477,6 +1585,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "BOM", "length": 0, "no_copy": 1, @@ -1486,6 +1595,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, @@ -1504,6 +1614,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Billed Amt", "length": 0, "no_copy": 1, @@ -1512,6 +1623,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, @@ -1530,6 +1642,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Landed Cost Voucher Amount", "length": 0, "no_copy": 1, @@ -1537,6 +1650,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, @@ -1555,6 +1669,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Brand", "length": 0, "no_copy": 0, @@ -1565,6 +1680,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, @@ -1584,6 +1700,7 @@ "ignore_xss_filter": 0, "in_filter": 1, "in_list_view": 0, + "in_standard_filter": 0, "label": "Item Group", "length": 0, "no_copy": 0, @@ -1594,6 +1711,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, @@ -1612,6 +1730,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Raw Materials Supplied Cost", "length": 0, "no_copy": 1, @@ -1623,6 +1742,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, @@ -1642,6 +1762,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Item Tax Amount", "length": 0, "no_copy": 1, @@ -1653,6 +1774,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, @@ -1672,6 +1794,7 @@ "ignore_xss_filter": 0, "in_filter": 0, "in_list_view": 0, + "in_standard_filter": 0, "label": "Valuation Rate", "length": 0, "no_copy": 1, @@ -1683,6 +1806,7 @@ "print_hide_if_no_value": 0, "print_width": "80px", "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, @@ -1703,6 +1827,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, @@ -1712,6 +1837,7 @@ "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 1, + "remember_last_selected_value": 0, "report_hide": 1, "reqd": 0, "search_index": 0, @@ -1730,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": 0, @@ -1739,6 +1866,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, @@ -1756,7 +1884,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-08-26 04:44:03.973239", + "modified": "2016-11-10 01:49:10.080408", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt Item", From c2cd3fd2c66bc180656e11bf1b9c3e96471c5124 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Mon, 14 Nov 2016 21:57:05 +0530 Subject: [PATCH 2/9] Function in parent transaction.js and call from corresponding files --- .../purchase_invoice_item.json | 6 +- erpnext/public/js/controllers/transaction.js | 56 +++++++++---------- .../purchase_receipt/purchase_receipt.js | 20 +------ 3 files changed, 33 insertions(+), 49 deletions(-) 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 70c6ba2378..ddd2d48022 100755 --- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json +++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json @@ -1013,11 +1013,11 @@ "in_standard_filter": 0, "label": "Quality Inspection", "length": 0, - "no_copy": 0, + "no_copy": 1, "options": "Quality Inspection", "permlevel": 0, "precision": "", - "print_hide": 0, + "print_hide": 1, "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, @@ -1814,7 +1814,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2016-11-10 01:53:28.457971", + "modified": "2016-11-11 05:26:47.383600", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice Item", diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index a301c96925..e6bc00b289 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -83,7 +83,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ }, onload: function() { var me = this; - //this.frm.show_print_first = true; if(this.frm.doc.__islocal) { var today = get_today(), currency = frappe.defaults.get_user_default("currency"); @@ -136,7 +135,34 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ } }); } + }, + setup_quality_inspection: function(inspection_type) { + var me = this; + var quality_inspection = frappe.meta.get_docfield(this.frm.doc.items[0].doctype, "quality_inspection"); + quality_inspection.get_route_options_for_new_doc = function(field) { + if(me.frm.is_new()) return; + var doc = field.doc; + return { + "inspection_type": inspection_type, + "purchase_receipt_no": me.frm.doc.name, + "item_code": me.doc.item_code, + "description": me.doc.description, + "item_serial_no": me.doc.serial_no ? me.doc.serial_no.split("\n")[0] : null, + "batch_no": me.doc.batch_no + } + } + console.log(quality_inspection); + this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { + var d = locals[cdt][cdn]; + return { + filters: { + docstatus: 1, + inspection_type: inspection_type, + item_code: d.item_code + } + } + }); }, onload_post_render: function() { @@ -1005,31 +1031,5 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ return method }, - - setup_quality_inspection: function(doctype_name, inspection_type) { - var quality_inspection = frappe.meta.get_docfield(doctype_name, "quality_inspection"); - quality_inspection.get_route_options_for_new_doc = function(field) { - if(frm.is_new()) return; - var doc = field.doc; - return { - "inspection_type": inspection_type, - "purchase_receipt_no": 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 - } - } - this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - return { - filters: { - docstatus: 1, - inspection_type: inspection_type, - item_code: d.item_code - } - } - }); - - } + }); \ No newline at end of file diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 526a109391..e4fcaa9bdf 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -7,21 +7,6 @@ frappe.provide("erpnext.stock"); frappe.ui.form.on("Purchase Receipt", { onload: function(frm) { - console.log('onload1'); - var quality_inspection = frappe.meta.get_docfield("Purchase Receipt Item", "quality_inspection"); - quality_inspection.get_route_options_for_new_doc = function(field) { - if(frm.is_new()) return; - var doc = field.doc; - return { - "inspection_type": "Incoming", - "purchase_receipt_no": 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 - } - } - console.log(quality_inspection); $.each(["warehouse", "rejected_warehouse"], function(i, field) { frm.set_query(field, "items", function() { return { @@ -48,9 +33,8 @@ frappe.ui.form.on("Purchase Receipt", { erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({ onload: function() { this._super(); - console.log(' before onload2'); - //this.setup_inspection_required_filter('Incoming'); - this.setup_quality_inspection("Purchase Receipt Item","Incoming") + console.log('----> TESTING'); + this.setup_quality_inspection("Incoming") }, refresh: function() { this._super(); From a8d1bc7ff437a0e63a27f5a5d9cd52a9788eeb13 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Tue, 15 Nov 2016 14:48:23 +0530 Subject: [PATCH 3/9] [Fix] Quality Inspection in Purchase Invoice fixed --- .../doctype/purchase_invoice/purchase_invoice.js | 3 ++- erpnext/public/js/controllers/transaction.js | 14 +++++++------- .../doctype/purchase_receipt/purchase_receipt.js | 3 +-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index ccdd87ff1d..ca66ee25b4 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -8,7 +8,8 @@ frappe.provide("erpnext.accounts"); erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ onload: function() { this._super(); - + console.log('----> TESTING'); + this.setup_quality_inspection("Incoming"); if(!this.frm.doc.__islocal) { // show credit_to in print format if(!this.frm.doc.supplier && this.frm.doc.credit_to) { diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index e6bc00b289..cce13e9e3a 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -139,20 +139,20 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ setup_quality_inspection: function(inspection_type) { var me = this; - var quality_inspection = frappe.meta.get_docfield(this.frm.doc.items[0].doctype, "quality_inspection"); - quality_inspection.get_route_options_for_new_doc = function(field) { + var quality_inspection_field = this.frm.get_docfield("items", "quality_inspection"); + quality_inspection_field.get_route_options_for_new_doc = function(field) { + console.log(field); if(me.frm.is_new()) return; var doc = field.doc; return { "inspection_type": inspection_type, "purchase_receipt_no": me.frm.doc.name, - "item_code": me.doc.item_code, - "description": me.doc.description, - "item_serial_no": me.doc.serial_no ? me.doc.serial_no.split("\n")[0] : null, - "batch_no": me.doc.batch_no + "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 } } - console.log(quality_inspection); this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { var d = locals[cdt][cdn]; return { diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index e4fcaa9bdf..58d9060f61 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -33,8 +33,7 @@ frappe.ui.form.on("Purchase Receipt", { erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend({ onload: function() { this._super(); - console.log('----> TESTING'); - this.setup_quality_inspection("Incoming") + this.setup_quality_inspection("Incoming"); }, refresh: function() { this._super(); From 34feab1b25d9991018c5cf75db224e8e0b290daa Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Wed, 16 Nov 2016 14:36:28 +0530 Subject: [PATCH 4/9] [Fix] Redesign of quality inspection doctype --- .../doctype/quality_inspection/README.md | 1 - .../doctype/quality_inspection/__init__.py | 1 - .../quality_inspection/quality_inspection.js | 68 -- .../quality_inspection.json | 727 ------------------ .../quality_inspection/quality_inspection.py | 63 -- .../test_quality_inspection.py | 10 - .../quality_inspection_reading/README.md | 1 - .../quality_inspection_reading/__init__.py | 1 - .../quality_inspection_reading.json | 374 --------- .../quality_inspection_reading.py | 10 - erpnext/public/js/controllers/transaction.js | 5 +- 11 files changed, 3 insertions(+), 1258 deletions(-) delete mode 100644 erpnext/buying/doctype/quality_inspection/README.md delete mode 100644 erpnext/buying/doctype/quality_inspection/__init__.py delete mode 100644 erpnext/buying/doctype/quality_inspection/quality_inspection.js delete mode 100644 erpnext/buying/doctype/quality_inspection/quality_inspection.json delete mode 100644 erpnext/buying/doctype/quality_inspection/quality_inspection.py delete mode 100644 erpnext/buying/doctype/quality_inspection/test_quality_inspection.py delete mode 100644 erpnext/buying/doctype/quality_inspection_reading/README.md delete mode 100644 erpnext/buying/doctype/quality_inspection_reading/__init__.py delete mode 100644 erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.json delete mode 100644 erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.py diff --git a/erpnext/buying/doctype/quality_inspection/README.md b/erpnext/buying/doctype/quality_inspection/README.md deleted file mode 100644 index 3a6a4c92dc..0000000000 --- a/erpnext/buying/doctype/quality_inspection/README.md +++ /dev/null @@ -1 +0,0 @@ -Incoming quality inspection for received Items. \ No newline at end of file diff --git a/erpnext/buying/doctype/quality_inspection/__init__.py b/erpnext/buying/doctype/quality_inspection/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/erpnext/buying/doctype/quality_inspection/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.js b/erpnext/buying/doctype/quality_inspection/quality_inspection.js deleted file mode 100644 index 17bae36026..0000000000 --- a/erpnext/buying/doctype/quality_inspection/quality_inspection.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -// License: GNU General Public License v3. See license.txt - -cur_frm.cscript.inspection_type = function(doc, cdt, cdn) { - if(doc.inspection_type == 'Incoming'){ - doc.delivery_note_no = ''; - hide_field('delivery_note_no'); - unhide_field('purchase_receipt_no'); - } - else if(doc.inspection_type == 'Outgoing'){ - doc.purchase_receipt_no = ''; - unhide_field('delivery_note_no'); - hide_field('purchase_receipt_no'); - - } - else { - doc.purchase_receipt_no = ''; - doc.delivery_note_no = ''; - hide_field('purchase_receipt_no'); - hide_field('delivery_note_no'); - } -} - -cur_frm.cscript.refresh = cur_frm.cscript.inspection_type; - -// item code based on GRN/DN -cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { - if (doc.purchase_receipt_no) { - return { - query: "erpnext.buying.doctype.quality_inspection.quality_inspection.item_query", - filters: { - "from": "Purchase Receipt Item", - "parent": doc.purchase_receipt_no - } - } - } else if(doc.delivery_note_no) { - return { - query: "erpnext.buying.doctype.quality_inspection.quality_inspection.item_query", - filters: { - "from": "Delivery Note Item", - "parent": doc.delivery_note_no - } - } - } -} - -// Serial No based on item_code -cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) { - var filters = {}; - if (doc.item_code) { - filters = { - 'item_code': doc.item_code - } - } - return { filters: filters } -} - -cur_frm.set_query("batch_no", function(doc) { - return { - filters: { - "item": doc.item_code - } - } -}) - -cur_frm.add_fetch('item_code', 'item_name', 'item_name'); -cur_frm.add_fetch('item_code', 'description', 'description'); - diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.json b/erpnext/buying/doctype/quality_inspection/quality_inspection.json deleted file mode 100644 index 3affe343fe..0000000000 --- a/erpnext/buying/doctype/quality_inspection/quality_inspection.json +++ /dev/null @@ -1,727 +0,0 @@ -{ - "allow_copy": 0, - "allow_import": 0, - "allow_rename": 0, - "autoname": "naming_series:", - "beta": 0, - "creation": "2013-04-30 13:13:03", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "fields": [ - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "naming_series", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Series", - "length": 0, - "no_copy": 1, - "options": "QI-", - "permlevel": 0, - "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, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "Today", - "fieldname": "report_date", - "fieldtype": "Date", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 1, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Report Date", - "length": 0, - "no_copy": 0, - "oldfieldname": "report_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 1, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break_4", - "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": "inspection_type", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 1, - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Inspection Type", - "length": 0, - "no_copy": 0, - "oldfieldname": "inspection_type", - "oldfieldtype": "Select", - "options": "\nIncoming\nOutgoing\nIn Process", - "permlevel": 0, - "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, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "purchase_receipt_no", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Purchase Receipt No", - "length": 0, - "no_copy": 0, - "oldfieldname": "purchase_receipt_no", - "oldfieldtype": "Link", - "options": "Purchase Receipt", - "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": 1, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "delivery_note_no", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Delivery Note No", - "length": 0, - "no_copy": 0, - "oldfieldname": "delivery_note_no", - "oldfieldtype": "Link", - "options": "Delivery Note", - "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": 1, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_7", - "fieldtype": "Section 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": "item_code", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 1, - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Item Code", - "length": 0, - "no_copy": 0, - "oldfieldname": "item_code", - "oldfieldtype": "Link", - "options": "Item", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 1, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "item_serial_no", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Item Serial No", - "length": 0, - "no_copy": 0, - "oldfieldname": "item_serial_no", - "oldfieldtype": "Link", - "options": "Serial No", - "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": "batch_no", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Batch No", - "length": 0, - "no_copy": 0, - "oldfieldname": "batch_no", - "oldfieldtype": "Link", - "options": "Batch", - "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": "sample_size", - "fieldtype": "Float", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Sample Size", - "length": 0, - "no_copy": 0, - "oldfieldname": "sample_size", - "oldfieldtype": "Currency", - "permlevel": 0, - "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, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "column_break1", - "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, - "oldfieldtype": "Column Break", - "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, - "width": "50%" - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "item_name", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Item Name", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "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, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "description", - "fieldtype": "Small Text", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 1, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Description", - "length": 0, - "no_copy": 0, - "oldfieldname": "description", - "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, - "set_only_once": 0, - "unique": 0, - "width": "300px" - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "section_break_14", - "fieldtype": "Section 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, - "default": "user", - "fieldname": "inspected_by", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Inspected By", - "length": 0, - "no_copy": 0, - "oldfieldname": "inspected_by", - "oldfieldtype": "Data", - "options": "User", - "permlevel": 0, - "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, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "verified_by", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Verified By", - "length": 0, - "no_copy": 0, - "oldfieldname": "verified_by", - "oldfieldtype": "Data", - "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": "column_break_17", - "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": "remarks", - "fieldtype": "Text", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Remarks", - "length": 0, - "no_copy": 1, - "oldfieldname": "remarks", - "oldfieldtype": "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, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "amended_from", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 1, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Amended From", - "length": 0, - "no_copy": 1, - "oldfieldname": "amended_from", - "oldfieldtype": "Data", - "options": "Quality Inspection", - "permlevel": 0, - "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, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "specification_details", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "", - "length": 0, - "no_copy": 0, - "oldfieldtype": "Section Break", - "options": "Simple", - "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": "get_specification_details", - "fieldtype": "Button", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Get Specification Details", - "length": 0, - "no_copy": 0, - "options": "get_item_specification_details", - "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": "readings", - "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Readings", - "length": 0, - "no_copy": 0, - "oldfieldname": "qa_specification_details", - "oldfieldtype": "Table", - "options": "Quality Inspection Reading", - "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 - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "icon": "icon-search", - "idx": 1, - "image_view": 0, - "in_create": 0, - "in_dialog": 0, - "is_submittable": 1, - "issingle": 0, - "istable": 0, - "max_attachments": 0, - "modified": "2016-11-07 05:27:52.422491", - "modified_by": "Administrator", - "module": "Buying", - "name": "Quality Inspection", - "owner": "Administrator", - "permissions": [ - { - "amend": 1, - "apply_user_permissions": 0, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "is_custom": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 1, - "role": "Quality Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 1, - "write": 1 - } - ], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "search_fields": "item_code, report_date, purchase_receipt_no, delivery_note_no", - "sort_order": "ASC", - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/buying/doctype/quality_inspection/quality_inspection.py b/erpnext/buying/doctype/quality_inspection/quality_inspection.py deleted file mode 100644 index ba77d3a5a8..0000000000 --- a/erpnext/buying/doctype/quality_inspection/quality_inspection.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import frappe - - -from frappe.model.document import Document - -class QualityInspection(Document): - def get_item_specification_details(self): - self.set('readings', []) - variant_of = frappe.db.get_value("Item", self.item_code, "variant_of") - if variant_of: - specification = frappe.db.sql("select specification, value from `tabItem Quality Inspection Parameter` \ - where parent in (%s, %s) order by idx", (self.item_code, variant_of)) - else: - specification = frappe.db.sql("select specification, value from `tabItem Quality Inspection Parameter` \ - where parent = %s order by idx", self.item_code) - for d in specification: - child = self.append('readings', {}) - child.specification = d[0] - child.value = d[1] - child.status = 'Accepted' - - def on_submit(self): - if self.purchase_receipt_no: - frappe.db.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` 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_no): - 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)) - - def on_cancel(self): - if self.purchase_receipt_no: - 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_no): - 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)) - -def item_query(doctype, txt, searchfield, start, page_len, filters): - if filters.get("from"): - from frappe.desk.reportview import get_match_cond - filters.update({ - "txt": txt, - "mcond": get_match_cond(filters["from"]), - "start": start, - "page_len": page_len - }) - return frappe.db.sql("""select item_code from `tab%(from)s` - where parent='%(parent)s' and docstatus < 2 and item_code like '%%%(txt)s%%' %(mcond)s - order by item_code limit %(start)s, %(page_len)s""" % filters) diff --git a/erpnext/buying/doctype/quality_inspection/test_quality_inspection.py b/erpnext/buying/doctype/quality_inspection/test_quality_inspection.py deleted file mode 100644 index 1c8ec23ebd..0000000000 --- a/erpnext/buying/doctype/quality_inspection/test_quality_inspection.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors -# See license.txt - -import frappe -import unittest - -# test_records = frappe.get_test_records('Quality Inspection') - -class TestQualityInspection(unittest.TestCase): - pass diff --git a/erpnext/buying/doctype/quality_inspection_reading/README.md b/erpnext/buying/doctype/quality_inspection_reading/README.md deleted file mode 100644 index 8fad6c914b..0000000000 --- a/erpnext/buying/doctype/quality_inspection_reading/README.md +++ /dev/null @@ -1 +0,0 @@ -Parameter reading for quality inspection of particular Item. \ No newline at end of file diff --git a/erpnext/buying/doctype/quality_inspection_reading/__init__.py b/erpnext/buying/doctype/quality_inspection_reading/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/erpnext/buying/doctype/quality_inspection_reading/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.json b/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.json deleted file mode 100644 index 099c768e5c..0000000000 --- a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "allow_copy": 0, - "allow_import": 0, - "allow_rename": 0, - "autoname": "hash", - "beta": 0, - "creation": "2013-02-22 01:27:43", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "editable_grid": 1, - "fields": [ - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "specification", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Parameter", - "length": 0, - "no_copy": 0, - "oldfieldname": "specification", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "value", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Acceptance Criteria", - "length": 0, - "no_copy": 0, - "oldfieldname": "value", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "reading_1", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Reading 1", - "length": 0, - "no_copy": 0, - "oldfieldname": "reading_1", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "reading_2", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Reading 2", - "length": 0, - "no_copy": 0, - "oldfieldname": "reading_2", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "reading_3", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Reading 3", - "length": 0, - "no_copy": 0, - "oldfieldname": "reading_3", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "reading_4", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Reading 4", - "length": 0, - "no_copy": 0, - "oldfieldname": "reading_4", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "reading_5", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Reading 5", - "length": 0, - "no_copy": 0, - "oldfieldname": "reading_5", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "reading_6", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Reading 6", - "length": 0, - "no_copy": 0, - "oldfieldname": "reading_6", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "reading_7", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Reading 7", - "length": 0, - "no_copy": 0, - "oldfieldname": "reading_7", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "reading_8", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Reading 8", - "length": 0, - "no_copy": 0, - "oldfieldname": "reading_8", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "reading_9", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Reading 9", - "length": 0, - "no_copy": 0, - "oldfieldname": "reading_9", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "fieldname": "reading_10", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Reading 10", - "length": 0, - "no_copy": 0, - "oldfieldname": "reading_10", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - }, - { - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "default": "Accepted", - "fieldname": "status", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_list_view": 0, - "label": "Status", - "length": 0, - "no_copy": 0, - "oldfieldname": "status", - "oldfieldtype": "Select", - "options": "Accepted\nRejected", - "permlevel": 0, - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "unique": 0 - } - ], - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 1, - "image_view": 0, - "in_create": 0, - "in_dialog": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2016-07-11 03:28:06.296900", - "modified_by": "Administrator", - "module": "Buying", - "name": "Quality Inspection Reading", - "owner": "Administrator", - "permissions": [], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "track_seen": 0 -} \ No newline at end of file diff --git a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.py b/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.py deleted file mode 100644 index 65188a22c6..0000000000 --- a/erpnext/buying/doctype/quality_inspection_reading/quality_inspection_reading.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import frappe - -from frappe.model.document import Document - -class QualityInspectionReading(Document): - pass \ No newline at end of file diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index cce13e9e3a..2e07e4ff66 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -141,18 +141,19 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ var me = this; var quality_inspection_field = this.frm.get_docfield("items", "quality_inspection"); quality_inspection_field.get_route_options_for_new_doc = function(field) { - console.log(field); if(me.frm.is_new()) return; var doc = field.doc; return { "inspection_type": inspection_type, - "purchase_receipt_no": me.frm.doc.name, + "reference_type": me.frm.doc.doctype, + "purchase_receipt": 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 } } + console.log(quality_inspection_field); this.frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { var d = locals[cdt][cdn]; return { From dbc2511a395e9fe69945cc5fb0cd140c68290587 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Wed, 16 Nov 2016 15:06:08 +0530 Subject: [PATCH 5/9] [Fix] Delivery Note fixed --- .../purchase_invoice/purchase_invoice.js | 7 +++-- erpnext/public/js/controllers/transaction.js | 3 +- .../doctype/delivery_note/delivery_note.js | 28 ++++--------------- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index ca66ee25b4..ee25272f8c 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -8,8 +8,7 @@ frappe.provide("erpnext.accounts"); erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ onload: function() { this._super(); - console.log('----> TESTING'); - this.setup_quality_inspection("Incoming"); + if(!this.frm.doc.__islocal) { // show credit_to in print format if(!this.frm.doc.supplier && this.frm.doc.credit_to) { @@ -34,6 +33,10 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ 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/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 2e07e4ff66..53a489c830 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -146,14 +146,13 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ return { "inspection_type": inspection_type, "reference_type": me.frm.doc.doctype, - "purchase_receipt": me.frm.doc.name, + "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 } } - console.log(quality_inspection_field); 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 2597280876..baeb069d88 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -8,19 +8,6 @@ frappe.provide("erpnext.stock.delivery_note"); frappe.ui.form.on("Delivery Note", { setup: function(frm) { - var quality_inspection = frappe.meta.get_docfield("Delivery Note Item", "quality_inspection"); - quality_inspection.get_route_options_for_new_doc = function(field) { - if(frm.is_new()) return; - var doc = field.doc; - return { - "inspection_type": "Outgoing", - "delivery_note_no": 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 - } - } frm.set_indicator_formatter('item_code', function(doc) { @@ -36,20 +23,15 @@ frappe.ui.form.on("Delivery Note", { } }) - frm.set_query("quality_inspection", "items", function(doc, cdt, cdn) { - var d = locals[cdt][cdn]; - return { - filters: { - docstatus: 1, - inspection_type: "Outgoing", - item_code: d.item_code - } - } - }) } }); 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") { From 55756d71b638c49481955e68b71861d387b0484e Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Wed, 16 Nov 2016 15:07:51 +0530 Subject: [PATCH 6/9] [Fix] Change of module of quality inspection --- .../doctype/quality_inspection/README.md | 1 + .../doctype/quality_inspection/__init__.py | 1 + .../quality_inspection/quality_inspection.js | 48 ++ .../quality_inspection.json | 727 ++++++++++++++++++ .../quality_inspection/quality_inspection.py | 63 ++ .../test_quality_inspection.py | 10 + .../quality_inspection_reading/README.md | 1 + .../quality_inspection_reading/__init__.py | 1 + .../quality_inspection_reading.json | 413 ++++++++++ .../quality_inspection_reading.py | 10 + 10 files changed, 1275 insertions(+) create mode 100644 erpnext/stock/doctype/quality_inspection/README.md create mode 100644 erpnext/stock/doctype/quality_inspection/__init__.py create mode 100644 erpnext/stock/doctype/quality_inspection/quality_inspection.js create mode 100644 erpnext/stock/doctype/quality_inspection/quality_inspection.json create mode 100644 erpnext/stock/doctype/quality_inspection/quality_inspection.py create mode 100644 erpnext/stock/doctype/quality_inspection/test_quality_inspection.py create mode 100644 erpnext/stock/doctype/quality_inspection_reading/README.md create mode 100644 erpnext/stock/doctype/quality_inspection_reading/__init__.py create mode 100644 erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.json create mode 100644 erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py diff --git a/erpnext/stock/doctype/quality_inspection/README.md b/erpnext/stock/doctype/quality_inspection/README.md new file mode 100644 index 0000000000..3a6a4c92dc --- /dev/null +++ b/erpnext/stock/doctype/quality_inspection/README.md @@ -0,0 +1 @@ +Incoming quality inspection for received Items. \ No newline at end of file diff --git a/erpnext/stock/doctype/quality_inspection/__init__.py b/erpnext/stock/doctype/quality_inspection/__init__.py new file mode 100644 index 0000000000..baffc48825 --- /dev/null +++ b/erpnext/stock/doctype/quality_inspection/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.js b/erpnext/stock/doctype/quality_inspection/quality_inspection.js new file mode 100644 index 0000000000..e85e1f8e82 --- /dev/null +++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.js @@ -0,0 +1,48 @@ +// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +// License: GNU General Public License v3. See license.txt + +cur_frm.cscript.refresh = cur_frm.cscript.inspection_type; + +// item code based on GRN/DN +cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) { + if (doc.purchase_receipt) { + 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 + } + } + } +} + +// Serial No based on item_code +cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) { + var filters = {}; + if (doc.item_code) { + filters = { + 'item_code': doc.item_code + } + } + return { filters: filters } +} + +cur_frm.set_query("batch_no", function(doc) { + return { + filters: { + "item": doc.item_code + } + } +}) + +cur_frm.add_fetch('item_code', 'item_name', 'item_name'); +cur_frm.add_fetch('item_code', 'description', 'description'); + diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.json b/erpnext/stock/doctype/quality_inspection/quality_inspection.json new file mode 100644 index 0000000000..76e82f8fcd --- /dev/null +++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.json @@ -0,0 +1,727 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "naming_series:", + "beta": 0, + "creation": "2013-04-30 13:13:03", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "naming_series", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Series", + "length": 0, + "no_copy": 1, + "options": "QI-", + "permlevel": 0, + "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, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Today", + "fieldname": "report_date", + "fieldtype": "Date", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 1, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Report Date", + "length": 0, + "no_copy": 0, + "oldfieldname": "report_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 1, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_4", + "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": "inspection_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Inspection Type", + "length": 0, + "no_copy": 0, + "oldfieldname": "inspection_type", + "oldfieldtype": "Select", + "options": "\nIncoming\nOutgoing\nIn Process", + "permlevel": 0, + "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, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "reference_type", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reference Type", + "length": 0, + "no_copy": 0, + "options": "\nPurchase Receipt\nPurchase Invoice\nDelivery Note\nSales Invoice", + "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, + "depends_on": "", + "fieldname": "reference_name", + "fieldtype": "Dynamic Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 1, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Reference Name", + "length": 0, + "no_copy": 0, + "oldfieldname": "purchase_receipt_no", + "oldfieldtype": "Link", + "options": "reference_type", + "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": "section_break_7", + "fieldtype": "Section 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": "item_code", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 1, + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Item Code", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_code", + "oldfieldtype": "Link", + "options": "Item", + "permlevel": 0, + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 1, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_serial_no", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Serial No", + "length": 0, + "no_copy": 0, + "oldfieldname": "item_serial_no", + "oldfieldtype": "Link", + "options": "Serial No", + "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": "batch_no", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Batch No", + "length": 0, + "no_copy": 0, + "oldfieldname": "batch_no", + "oldfieldtype": "Link", + "options": "Batch", + "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": "sample_size", + "fieldtype": "Float", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Sample Size", + "length": 0, + "no_copy": 0, + "oldfieldname": "sample_size", + "oldfieldtype": "Currency", + "permlevel": 0, + "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, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break1", + "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, + "oldfieldtype": "Column Break", + "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, + "width": "50%" + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "item_name", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Item Name", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "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, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "description", + "fieldtype": "Small Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 1, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Description", + "length": 0, + "no_copy": 0, + "oldfieldname": "description", + "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, + "set_only_once": 0, + "unique": 0, + "width": "300px" + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "section_break_14", + "fieldtype": "Section 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, + "default": "user", + "fieldname": "inspected_by", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Inspected By", + "length": 0, + "no_copy": 0, + "oldfieldname": "inspected_by", + "oldfieldtype": "Data", + "options": "User", + "permlevel": 0, + "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, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "verified_by", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Verified By", + "length": 0, + "no_copy": 0, + "oldfieldname": "verified_by", + "oldfieldtype": "Data", + "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": "column_break_17", + "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": "remarks", + "fieldtype": "Text", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Remarks", + "length": 0, + "no_copy": 1, + "oldfieldname": "remarks", + "oldfieldtype": "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, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "amended_from", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 1, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Amended From", + "length": 0, + "no_copy": 1, + "oldfieldname": "amended_from", + "oldfieldtype": "Data", + "options": "Quality Inspection", + "permlevel": 0, + "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, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "specification_details", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "", + "length": 0, + "no_copy": 0, + "oldfieldtype": "Section Break", + "options": "Simple", + "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": "get_specification_details", + "fieldtype": "Button", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Get Specification Details", + "length": 0, + "no_copy": 0, + "options": "get_item_specification_details", + "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": "readings", + "fieldtype": "Table", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Readings", + "length": 0, + "no_copy": 0, + "oldfieldname": "qa_specification_details", + "oldfieldtype": "Table", + "options": "Quality Inspection Reading", + "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 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "icon": "icon-search", + "idx": 1, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 1, + "issingle": 0, + "istable": 0, + "max_attachments": 0, + "modified": "2016-11-16 04:26:57.853527", + "modified_by": "Administrator", + "module": "Stock", + "name": "Quality Inspection", + "owner": "Administrator", + "permissions": [ + { + "amend": 1, + "apply_user_permissions": 0, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "is_custom": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "Quality Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 1, + "write": 1 + } + ], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "search_fields": "item_code, report_date, reference_name", + "sort_order": "ASC", + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py new file mode 100644 index 0000000000..750db06a95 --- /dev/null +++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py @@ -0,0 +1,63 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + + +from frappe.model.document import Document + +class QualityInspection(Document): + def get_item_specification_details(self): + self.set('readings', []) + variant_of = frappe.db.get_value("Item", self.item_code, "variant_of") + if variant_of: + specification = frappe.db.sql("select specification, value from `tabItem Quality Inspection Parameter` \ + where parent in (%s, %s) order by idx", (self.item_code, variant_of)) + else: + specification = frappe.db.sql("select specification, value from `tabItem Quality Inspection Parameter` \ + where parent = %s order by idx", self.item_code) + for d in specification: + child = self.append('readings', {}) + child.specification = d[0] + child.value = d[1] + child.status = 'Accepted' + + def on_submit(self): + if self.purchase_receipt: + frappe.db.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` 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)) + + 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)) + +def item_query(doctype, txt, searchfield, start, page_len, filters): + if filters.get("from"): + from frappe.desk.reportview import get_match_cond + filters.update({ + "txt": txt, + "mcond": get_match_cond(filters["from"]), + "start": start, + "page_len": page_len + }) + return frappe.db.sql("""select item_code from `tab%(from)s` + where parent='%(parent)s' and docstatus < 2 and item_code like '%%%(txt)s%%' %(mcond)s + order by item_code limit %(start)s, %(page_len)s""" % filters) diff --git a/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py b/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py new file mode 100644 index 0000000000..1c8ec23ebd --- /dev/null +++ b/erpnext/stock/doctype/quality_inspection/test_quality_inspection.py @@ -0,0 +1,10 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors +# See license.txt + +import frappe +import unittest + +# test_records = frappe.get_test_records('Quality Inspection') + +class TestQualityInspection(unittest.TestCase): + pass diff --git a/erpnext/stock/doctype/quality_inspection_reading/README.md b/erpnext/stock/doctype/quality_inspection_reading/README.md new file mode 100644 index 0000000000..8fad6c914b --- /dev/null +++ b/erpnext/stock/doctype/quality_inspection_reading/README.md @@ -0,0 +1 @@ +Parameter reading for quality inspection of particular Item. \ No newline at end of file diff --git a/erpnext/stock/doctype/quality_inspection_reading/__init__.py b/erpnext/stock/doctype/quality_inspection_reading/__init__.py new file mode 100644 index 0000000000..baffc48825 --- /dev/null +++ b/erpnext/stock/doctype/quality_inspection_reading/__init__.py @@ -0,0 +1 @@ +from __future__ import unicode_literals diff --git a/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.json b/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.json new file mode 100644 index 0000000000..a3b43e98cb --- /dev/null +++ b/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.json @@ -0,0 +1,413 @@ +{ + "allow_copy": 0, + "allow_import": 0, + "allow_rename": 0, + "autoname": "hash", + "beta": 0, + "creation": "2013-02-22 01:27:43", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "editable_grid": 1, + "fields": [ + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "specification", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Parameter", + "length": 0, + "no_copy": 0, + "oldfieldname": "specification", + "oldfieldtype": "Data", + "permlevel": 0, + "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, + "set_only_once": 0, + "unique": 0 + }, + { + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "value", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Acceptance Criteria", + "length": 0, + "no_copy": 0, + "oldfieldname": "value", + "oldfieldtype": "Data", + "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": "reading_1", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Reading 1", + "length": 0, + "no_copy": 0, + "oldfieldname": "reading_1", + "oldfieldtype": "Data", + "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": "reading_2", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Reading 2", + "length": 0, + "no_copy": 0, + "oldfieldname": "reading_2", + "oldfieldtype": "Data", + "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": "reading_3", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Reading 3", + "length": 0, + "no_copy": 0, + "oldfieldname": "reading_3", + "oldfieldtype": "Data", + "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": "reading_4", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Reading 4", + "length": 0, + "no_copy": 0, + "oldfieldname": "reading_4", + "oldfieldtype": "Data", + "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": "reading_5", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reading 5", + "length": 0, + "no_copy": 0, + "oldfieldname": "reading_5", + "oldfieldtype": "Data", + "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": "reading_6", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reading 6", + "length": 0, + "no_copy": 0, + "oldfieldname": "reading_6", + "oldfieldtype": "Data", + "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": "reading_7", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reading 7", + "length": 0, + "no_copy": 0, + "oldfieldname": "reading_7", + "oldfieldtype": "Data", + "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": "reading_8", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reading 8", + "length": 0, + "no_copy": 0, + "oldfieldname": "reading_8", + "oldfieldtype": "Data", + "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": "reading_9", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reading 9", + "length": 0, + "no_copy": 0, + "oldfieldname": "reading_9", + "oldfieldtype": "Data", + "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": "reading_10", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Reading 10", + "length": 0, + "no_copy": 0, + "oldfieldname": "reading_10", + "oldfieldtype": "Data", + "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, + "default": "Accepted", + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "oldfieldname": "status", + "oldfieldtype": "Select", + "options": "Accepted\nRejected", + "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 + } + ], + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 1, + "image_view": 0, + "in_create": 0, + "in_dialog": 0, + "is_submittable": 0, + "issingle": 0, + "istable": 1, + "max_attachments": 0, + "modified": "2016-11-16 03:55:50.046712", + "modified_by": "Administrator", + "module": "Stock", + "name": "Quality Inspection Reading", + "owner": "Administrator", + "permissions": [], + "quick_entry": 0, + "read_only": 0, + "read_only_onload": 0, + "track_seen": 0 +} \ No newline at end of file diff --git a/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py b/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py new file mode 100644 index 0000000000..65188a22c6 --- /dev/null +++ b/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py @@ -0,0 +1,10 @@ +# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import frappe + +from frappe.model.document import Document + +class QualityInspectionReading(Document): + pass \ No newline at end of file From 8af429da1fdd70f853c43faa59a5a5981da8112f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 16 Nov 2016 17:21:59 +0530 Subject: [PATCH 7/9] Cleanup and fixes in quality inspection feature --- .../purchase_invoice/purchase_invoice.js | 6 +- .../purchase_invoice/purchase_invoice.py | 4 - .../purchase_invoice_item.json | 30 +-- .../sales_invoice_item.json | 222 +++++++++++++++--- erpnext/controllers/stock_controller.py | 21 +- erpnext/patches.txt | 3 +- .../v7_1/rename_quality_inspection_field.py | 39 +++ erpnext/public/js/controllers/transaction.js | 23 +- .../doctype/delivery_note/delivery_note.js | 6 - .../doctype/delivery_note/delivery_note.py | 1 - .../delivery_note_item.json | 3 +- erpnext/stock/doctype/item/item.json | 4 +- .../purchase_receipt/purchase_receipt.js | 12 - .../purchase_receipt/purchase_receipt.py | 1 - .../purchase_receipt_item.json | 3 +- .../quality_inspection/quality_inspection.js | 14 +- .../quality_inspection/quality_inspection.py | 34 +-- 17 files changed, 287 insertions(+), 139 deletions(-) create mode 100644 erpnext/patches/v7_1/rename_quality_inspection_field.py diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index ee25272f8c..bf2e43deda 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -32,11 +32,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ 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 a8ffb203c3..5c2b62cd02 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -67,10 +67,6 @@ class PurchaseInvoice(BuyingController): 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 ddd2d48022..6f8e219f88 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, @@ -1027,33 +1028,6 @@ "set_only_once": 0, "unique": 0 }, - { - "allow_on_submit": 0, - "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, @@ -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 7be5a24516..944230b1d0 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 bf3ba6fe31..631685e8df 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -11,6 +11,10 @@ from erpnext.accounts.general_ledger import make_gl_entries, delete_gl_entries, 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 @@ class StockController(AccountsController): "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 03ad708991..28db695460 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -349,4 +349,5 @@ erpnext.patches.v7_1.add_account_user_role_for_timesheet 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 0000000000..25f432c8c6 --- /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 53a489c830..b529f0f1c9 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -79,7 +79,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ frm.cscript.calculate_taxes_and_totals(); }); - }, onload: function() { var me = this; @@ -135,24 +134,32 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ } }); } + + 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 baeb069d88..204e98a012 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -8,7 +8,6 @@ frappe.provide("erpnext.stock.delivery_note"); 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 @@ frappe.ui.form.on("Delivery Note", { }); 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 64a484aa9c..5e31ac3098 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -103,7 +103,6 @@ class DeliveryNote(SellingController): 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 4653c8ff31..9b83cf291b 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 4c0dda89f5..67529f1470 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 58d9060f61..457a7c2245 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -31,10 +31,6 @@ frappe.ui.form.on("Purchase Receipt", { }); 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['select_print_heading'].get_query = function(doc, cdt, cdn) } } -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 8dabea2525..4bcde6a49a 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py @@ -52,7 +52,6 @@ class PurchaseReceipt(BuyingController): 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 8ee1dde6ee..d8449f1ebb 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 e85e1f8e82..5d7b6b4153 100644 --- a/erpnext/stock/doctype/quality_inspection/quality_inspection.js +++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.js @@ -5,20 +5,12 @@ cur_frm.cscript.refresh = cur_frm.cscript.inspection_type; // 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 750db06a95..3ba3056511 100644 --- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py +++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py @@ -24,30 +24,20 @@ class QualityInspection(Document): 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"): From 99dac07a562201e130a240cdff25ae716ec1ca5b Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Fri, 18 Nov 2016 12:52:34 +0530 Subject: [PATCH 8/9] [Fix] Minor fix for field rename --- erpnext/stock/doctype/item/item.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json index 67529f1470..6e103d41b7 100644 --- a/erpnext/stock/doctype/item/item.json +++ b/erpnext/stock/doctype/item/item.json @@ -2067,7 +2067,7 @@ "bold": 0, "collapsible": 0, "columns": 0, - "depends_on": "eval:(doc.inspection_required || doc.inspection_required_before_delivery)", + "depends_on": "eval:(doc.inspection_required_before_purchase || doc.inspection_required_before_delivery)", "description": "Will also apply to variants", "fieldname": "quality_parameters", "fieldtype": "Table", @@ -2683,7 +2683,7 @@ "issingle": 0, "istable": 0, "max_attachments": 1, - "modified": "2016-11-16 15:57:09.941178", + "modified": "2016-11-18 02:19:54.507883", "modified_by": "Administrator", "module": "Stock", "name": "Item", From 60db98aafff2b7eb47d36a43338e68dc59086df0 Mon Sep 17 00:00:00 2001 From: Manas Solanki Date: Fri, 18 Nov 2016 14:52:13 +0530 Subject: [PATCH 9/9] [Minor] Variable assignment before reference Variable = 'inspection_required_fieldname' --- erpnext/controllers/stock_controller.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index 631685e8df..0c85aa1bba 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -262,6 +262,7 @@ class StockController(AccountsController): '''Checks if quality inspection is set for Items that require inspection. On submit, throw an exception''' + inspection_required_fieldname = None if self.doctype in ["Purchase Receipt", "Purchase Invoice"]: inspection_required_fieldname = "inspection_required_before_purchase" elif self.doctype in ["Delivery Note", "Sales Invoice"]: