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