mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-24 05:47:15 +00:00
This commit is contained in:
@@ -155,8 +155,13 @@ class QualityInspection(Document):
|
||||
)
|
||||
|
||||
def before_submit(self):
|
||||
self.validate_sample_size()
|
||||
self.validate_readings_status_mandatory()
|
||||
|
||||
def validate_sample_size(self):
|
||||
if flt(self.sample_size) <= 0:
|
||||
frappe.throw(_("Sample Size must be greater than zero"), title=_("Invalid Sample Size"))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_item_specification_details(self):
|
||||
if not self.quality_inspection_template:
|
||||
|
||||
@@ -79,6 +79,17 @@ class TestQualityInspection(ERPNextTestSuite):
|
||||
qa.delete()
|
||||
dn.delete()
|
||||
|
||||
def test_qa_submit_requires_sample_size(self):
|
||||
dn = create_delivery_note(item_code="_Test Item with QA", do_not_submit=True)
|
||||
qa = create_quality_inspection(
|
||||
reference_type="Delivery Note", reference_name=dn.name, do_not_submit=True
|
||||
)
|
||||
|
||||
for sample_size in (0, -1):
|
||||
qa.reload()
|
||||
qa.sample_size = sample_size
|
||||
self.assertRaisesRegex(frappe.ValidationError, "Sample Size must be greater than zero", qa.submit)
|
||||
|
||||
def test_doc_update_published_for_reference_on_submit(self):
|
||||
"""Submitting a QI publishes doc_update so open reference forms resync their timestamp."""
|
||||
dn = create_delivery_note(item_code="_Test Item with QA", do_not_submit=True)
|
||||
|
||||
Reference in New Issue
Block a user