From 35a4cae2f6f7812244180defd0743a85b62ff1e1 Mon Sep 17 00:00:00 2001 From: Anurag Mishra <32095923+Anurag810@users.noreply.github.com> Date: Wed, 8 May 2019 17:41:04 +0530 Subject: [PATCH] feat: Adding action Stop or Warn for Quality inspection if it is not submitted * feat: added action on quality inspection * feat: added action on quality inspection * feat: Allow the user to by pass inspection if action is warn ad stop when action is to warn * patch: for setting default action to 'Stop' * fix: resolve conflicts * fix: travis * Update stock_controller.py --- erpnext/controllers/stock_controller.py | 10 +- erpnext/patches.txt | 1 + ...t_default_action_for_quality_inspection.py | 10 ++ .../stock_settings/stock_settings.json | 120 +++++++++++++++++- 4 files changed, 134 insertions(+), 7 deletions(-) create mode 100644 erpnext/patches/v11_1/set_default_action_for_quality_inspection.py diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py index d1ffd7db66d..af689808c07 100644 --- a/erpnext/controllers/stock_controller.py +++ b/erpnext/controllers/stock_controller.py @@ -351,10 +351,12 @@ class StockController(AccountsController): frappe.throw(_("Row {0}: Quality Inspection rejected for item {1}") .format(d.idx, d.item_code), QualityInspectionRejectedError) elif qa_required : - frappe.msgprint(_("Quality Inspection required for Item {0}").format(d.item_code)) - if self.docstatus==1: - raise QualityInspectionRequiredError - + action = frappe.get_doc('Stock Settings').action_if_quality_inspection_is_not_submitted + if self.docstatus==1 and action == 'Stop': + frappe.throw(_("Quality Inspection required for Item {0} to submit").format(frappe.bold(d.item_code)), + exc=QualityInspectionRequiredError) + else: + frappe.msgprint(_("Create Quality Inspection for Item {0}").format(frappe.bold(d.item_code))) def update_blanket_order(self): blanket_orders = list(set([d.blanket_order for d in self.items if d.blanket_order])) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 10a998e4e99..c060264a937 100755 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -592,6 +592,7 @@ erpnext.patches.v11_1.make_job_card_time_logs erpnext.patches.v11_1.set_variant_based_on erpnext.patches.v11_1.move_customer_lead_to_dynamic_column erpnext.patches.v11_1.woocommerce_set_creation_user +erpnext.patches.v11_1.set_default_action_for_quality_inspection erpnext.patches.v11_1.delete_bom_browser erpnext.patches.v11_1.set_salary_details_submittable erpnext.patches.v11_1.rename_depends_on_lwp diff --git a/erpnext/patches/v11_1/set_default_action_for_quality_inspection.py b/erpnext/patches/v11_1/set_default_action_for_quality_inspection.py new file mode 100644 index 00000000000..82d43b05206 --- /dev/null +++ b/erpnext/patches/v11_1/set_default_action_for_quality_inspection.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 + +def execute(): + stock_settings = frappe.get_doc('Stock Settings') + stock_settings.action_if_quality_inspection_is_not_submitted = "Stop" + stock_settings.save() \ No newline at end of file diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.json b/erpnext/stock/doctype/stock_settings/stock_settings.json index 4d5423e5476..3f7bf959dd5 100644 --- a/erpnext/stock/doctype/stock_settings/stock_settings.json +++ b/erpnext/stock/doctype/stock_settings/stock_settings.json @@ -1,5 +1,6 @@ { "allow_copy": 0, + "allow_events_in_timeline": 0, "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, @@ -14,11 +15,13 @@ "fields": [ { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, "default": "Item Code", + "fetch_if_empty": 0, "fieldname": "item_naming_by", "fieldtype": "Select", "hidden": 0, @@ -41,15 +44,18 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, "description": "", + "fetch_if_empty": 0, "fieldname": "item_group", "fieldtype": "Link", "hidden": 0, @@ -72,14 +78,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "stock_uom", "fieldtype": "Link", "hidden": 0, @@ -102,14 +111,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "default_warehouse", "fieldtype": "Link", "hidden": 0, @@ -133,14 +145,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "sample_retention_warehouse", "fieldtype": "Link", "hidden": 0, @@ -164,14 +179,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_4", "fieldtype": "Column Break", "hidden": 0, @@ -192,14 +210,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "valuation_method", "fieldtype": "Select", "hidden": 0, @@ -222,15 +243,18 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, "description": "Percentage you are allowed to receive or deliver more against the quantity ordered. For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units.", + "fetch_if_empty": 0, "fieldname": "tolerance", "fieldtype": "Float", "hidden": 0, @@ -252,15 +276,53 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "default": "Stop", + "fetch_if_empty": 0, + "fieldname": "action_if_quality_inspection_is_not_submitted", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Action if Quality inspection is not submitted", + "length": 0, + "no_copy": 0, + "options": "Stop\nWarn", + "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, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, "default": "1", + "fetch_if_empty": 0, "fieldname": "show_barcode_field", "fieldtype": "Check", "hidden": 0, @@ -283,15 +345,18 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, "default": "1", + "fetch_if_empty": 0, "fieldname": "clean_description_html", "fieldtype": "Check", "hidden": 0, @@ -314,14 +379,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "section_break_7", "fieldtype": "Section Break", "hidden": 0, @@ -343,14 +411,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "auto_insert_price_list_rate_if_missing", "fieldtype": "Check", "hidden": 0, @@ -373,14 +444,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "allow_negative_stock", "fieldtype": "Check", "hidden": 0, @@ -402,14 +476,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "column_break_10", "fieldtype": "Column Break", "hidden": 0, @@ -431,15 +508,18 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, "default": "1", + "fetch_if_empty": 0, "fieldname": "automatically_set_serial_nos_based_on_fifo", "fieldtype": "Check", "hidden": 0, @@ -462,15 +542,18 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, "default": "1", + "fetch_if_empty": 0, "fieldname": "set_qty_in_transactions_based_on_serial_no_input", "fieldtype": "Check", "hidden": 0, @@ -493,14 +576,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "auto_material_request", "fieldtype": "Section Break", "hidden": 0, @@ -522,14 +608,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "auto_indent", "fieldtype": "Check", "hidden": 0, @@ -551,14 +640,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "reorder_email_notify", "fieldtype": "Check", "hidden": 0, @@ -580,14 +672,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "freeze_stock_entries", "fieldtype": "Section Break", "hidden": 0, @@ -609,14 +704,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "stock_frozen_upto", "fieldtype": "Date", "hidden": 0, @@ -638,14 +736,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "stock_frozen_upto_days", "fieldtype": "Int", "hidden": 0, @@ -667,14 +768,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "stock_auth_role", "fieldtype": "Link", "hidden": 0, @@ -697,14 +801,17 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_if_empty": 0, "fieldname": "batch_id_sb", "fieldtype": "Section Break", "hidden": 0, @@ -727,15 +834,18 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, "default": "0", + "fetch_if_empty": 0, "fieldname": "use_naming_series", "fieldtype": "Check", "hidden": 0, @@ -758,16 +868,19 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, "default": "BATCH-", "depends_on": "eval:doc.use_naming_series==1", + "fetch_if_empty": 0, "fieldname": "naming_series_prefix", "fieldtype": "Data", "hidden": 0, @@ -790,6 +903,7 @@ "reqd": 0, "search_index": 0, "set_only_once": 0, + "translatable": 0, "unique": 0 } ], @@ -804,7 +918,7 @@ "issingle": 1, "istable": 0, "max_attachments": 0, - "modified": "2018-05-03 12:38:12.905394", + "modified": "2019-04-18 12:33:08.040078", "modified_by": "Administrator", "module": "Stock", "name": "Stock Settings", @@ -812,7 +926,6 @@ "permissions": [ { "amend": 0, - "apply_user_permissions": 0, "cancel": 0, "create": 1, "delete": 0, @@ -837,5 +950,6 @@ "show_name_in_global_search": 0, "sort_order": "ASC", "track_changes": 0, - "track_seen": 0 + "track_seen": 0, + "track_views": 0 } \ No newline at end of file