Improve vendor validation for new receiving batch

This commit is contained in:
Lance Edgar 2022-03-25 12:33:37 -05:00
parent 777a7afd46
commit ae1e9dba0f
2 changed files with 21 additions and 1 deletions

View file

@ -405,6 +405,12 @@ class PurchasingBatchView(BatchMasterView):
'vendor_contact',
'status_code')
def valid_vendor_uuid(self, node, value):
model = self.model
vendor = self.Session.query(model.Vendor).get(value)
if not vendor:
raise colander.Invalid(node, "Invalid vendor selection")
def render_store(self, batch, field):
store = batch.store
if not store: