fix: Numeric/Non-numeric QI UX (#24516)
* chore: Show 1 field each of both types of Insoections in grid view * fix: Make QI check Numeric by default and make checkbox "Numeric" - Reducing cognitive load
This commit is contained in:
parent
9dcb286c31
commit
0ea2587679
@ -8,7 +8,7 @@
|
||||
"field_order": [
|
||||
"specification",
|
||||
"value",
|
||||
"non_numeric",
|
||||
"numeric",
|
||||
"column_break_3",
|
||||
"min_value",
|
||||
"max_value",
|
||||
@ -29,7 +29,7 @@
|
||||
"width": "100px"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && doc.non_numeric)",
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && !doc.numeric)",
|
||||
"fieldname": "value",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
@ -55,32 +55,32 @@
|
||||
"label": "Formula Based Criteria"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && !doc.non_numeric)",
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && doc.numeric)",
|
||||
"fieldname": "min_value",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Minimum Value"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && !doc.non_numeric)",
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && doc.numeric)",
|
||||
"fieldname": "max_value",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Maximum Value"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "non_numeric",
|
||||
"default": "1",
|
||||
"fieldname": "numeric",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Non-Numeric",
|
||||
"label": "Numeric",
|
||||
"width": "80px"
|
||||
}
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-01-07 21:32:49.866439",
|
||||
"modified": "2021-02-01 19:18:46.924399",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item Quality Inspection Parameter",
|
||||
|
@ -97,7 +97,7 @@ class QualityInspection(Document):
|
||||
self.set_status_based_on_acceptance_values(reading)
|
||||
|
||||
def set_status_based_on_acceptance_values(self, reading):
|
||||
if cint(reading.non_numeric):
|
||||
if not cint(reading.numeric):
|
||||
result = reading.get("reading_value") == reading.get("value")
|
||||
else:
|
||||
# numeric readings
|
||||
@ -136,7 +136,7 @@ class QualityInspection(Document):
|
||||
|
||||
def get_formula_evaluation_data(self, reading):
|
||||
data = {}
|
||||
if cint(reading.non_numeric):
|
||||
if not cint(reading.numeric):
|
||||
data = {"reading_value": reading.get("reading_value")}
|
||||
else:
|
||||
# numeric readings
|
||||
|
@ -55,7 +55,7 @@ class TestQualityInspection(unittest.TestCase):
|
||||
},
|
||||
{
|
||||
"specification": "Particle Inspection Needed", # non-numeric reading
|
||||
"non_numeric": 1,
|
||||
"numeric": 0,
|
||||
"value": "Yes",
|
||||
"reading_value": "Yes"
|
||||
}]
|
||||
@ -96,7 +96,7 @@ class TestQualityInspection(unittest.TestCase):
|
||||
{
|
||||
"specification": "Calcium Content", # non-numeric reading
|
||||
"formula_based_criteria": 1,
|
||||
"non_numeric": 1,
|
||||
"numeric": 0,
|
||||
"acceptance_formula": "reading_value in ('Grade A', 'Grade B', 'Grade C')",
|
||||
"reading_value": "Grade B"
|
||||
}]
|
||||
|
@ -9,7 +9,7 @@
|
||||
"specification",
|
||||
"status",
|
||||
"value",
|
||||
"non_numeric",
|
||||
"numeric",
|
||||
"manual_inspection",
|
||||
"column_break_4",
|
||||
"min_value",
|
||||
@ -46,7 +46,7 @@
|
||||
},
|
||||
{
|
||||
"columns": 2,
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && doc.non_numeric)",
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && !doc.numeric)",
|
||||
"fieldname": "value",
|
||||
"fieldtype": "Data",
|
||||
"label": "Acceptance Criteria Value",
|
||||
@ -54,7 +54,7 @@
|
||||
"oldfieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"columns": 1,
|
||||
"columns": 2,
|
||||
"fieldname": "reading_1",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
@ -66,7 +66,6 @@
|
||||
"columns": 1,
|
||||
"fieldname": "reading_2",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Reading 2",
|
||||
"oldfieldname": "reading_2",
|
||||
"oldfieldtype": "Data"
|
||||
@ -140,7 +139,7 @@
|
||||
"options": "\nAccepted\nRejected"
|
||||
},
|
||||
{
|
||||
"depends_on": "non_numeric",
|
||||
"depends_on": "eval:!doc.numeric",
|
||||
"fieldname": "section_break_3",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Value Based Inspection"
|
||||
@ -171,51 +170,52 @@
|
||||
"label": "Formula Based Criteria"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && !doc.non_numeric)",
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && doc.numeric)",
|
||||
"description": "Applied on each reading.",
|
||||
"fieldname": "min_value",
|
||||
"fieldtype": "Float",
|
||||
"label": "Minimum Value"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && !doc.non_numeric)",
|
||||
"depends_on": "eval:(!doc.formula_based_criteria && doc.numeric)",
|
||||
"description": "Applied on each reading.",
|
||||
"fieldname": "max_value",
|
||||
"fieldtype": "Float",
|
||||
"label": "Maximum Value"
|
||||
},
|
||||
{
|
||||
"depends_on": "non_numeric",
|
||||
"columns": 2,
|
||||
"depends_on": "eval:!doc.numeric",
|
||||
"fieldname": "reading_value",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Reading Value"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.non_numeric",
|
||||
"depends_on": "numeric",
|
||||
"fieldname": "section_break_14",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Numeric Inspection"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "non_numeric",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Non-Numeric"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Set the status manually.",
|
||||
"fieldname": "manual_inspection",
|
||||
"fieldtype": "Check",
|
||||
"label": "Manual Inspection"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "numeric",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Numeric"
|
||||
}
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-01-07 22:16:53.978410",
|
||||
"modified": "2021-02-01 19:46:22.138018",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Quality Inspection Reading",
|
||||
|
@ -14,6 +14,6 @@ def get_template_details(template):
|
||||
|
||||
return frappe.get_all('Item Quality Inspection Parameter',
|
||||
fields=["specification", "value", "acceptance_formula",
|
||||
"non_numeric", "formula_based_criteria", "min_value", "max_value"],
|
||||
"numeric", "formula_based_criteria", "min_value", "max_value"],
|
||||
filters={'parenttype': 'Quality Inspection Template', 'parent': template},
|
||||
order_by="idx")
|
Loading…
x
Reference in New Issue
Block a user