Merge pull request #50374 from aerele/support-52577

fix: add validation to reject empty readings
This commit is contained in:
rohitwaghchaure
2025-11-10 11:07:36 +05:30
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@@ -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:

View File

@@ -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: