Skip to content

Commit

Permalink
Merge pull request #64 from ChillarAnand/lis
Browse files Browse the repository at this point in the history
fix: Add validation for sample quantity in lab test template
  • Loading branch information
ruchamahabal committed Nov 29, 2021
2 parents 714263b + e725fcf commit 21a0a53
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from frappe import _
from frappe.model.document import Document
from frappe.model.rename_doc import rename_doc
from frappe.utils import flt


class LabTestTemplate(Document):
Expand All @@ -21,6 +22,9 @@ def validate(self):
if self.is_billable and (not self.lab_test_rate or self.lab_test_rate <= 0.0):
frappe.throw(_('Standard Selling Rate should be greater than zero.'))

if self.sample and flt(self.sample_qty) <= 0:
frappe.throw(_('Sample Quantity cannot be negative or 0'), title=_('Invalid Quantity'))

self.validate_conversion_factor()
self.enable_disable_item()

Expand Down

0 comments on commit 21a0a53

Please sign in to comment.