mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-16 08:05:00 +00:00
Merge pull request #50374 from aerele/support-52577
fix: add validation to reject empty readings
This commit is contained in:
@@ -283,9 +283,11 @@ class QualityInspection(Document):
|
||||
|
||||
def min_max_criteria_passed(self, reading):
|
||||
"""Determine whether all readings fall in the acceptable range."""
|
||||
has_reading = False
|
||||
for i in range(1, 11):
|
||||
reading_value = reading.get("reading_" + str(i))
|
||||
if reading_value is not None and reading_value.strip():
|
||||
has_reading = True
|
||||
result = (
|
||||
flt(reading.get("min_value"))
|
||||
<= parse_float(reading_value)
|
||||
@@ -293,7 +295,7 @@ class QualityInspection(Document):
|
||||
)
|
||||
if not result:
|
||||
return False
|
||||
return True
|
||||
return has_reading
|
||||
|
||||
def set_status_based_on_acceptance_formula(self, reading):
|
||||
if not reading.acceptance_formula:
|
||||
|
||||
@@ -292,7 +292,7 @@ def create_quality_inspection(**args):
|
||||
|
||||
if not args.readings:
|
||||
create_quality_inspection_parameter("Size")
|
||||
readings = {"specification": "Size", "min_value": 0, "max_value": 10}
|
||||
readings = {"specification": "Size", "min_value": 0, "max_value": 10, "reading_1": "5"}
|
||||
if args.status == "Rejected":
|
||||
readings["reading_1"] = "12" # status is auto set in child on save
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user