Share some code for validating vendor field

and add validation for new Ordering batch
This commit is contained in:
Lance Edgar 2023-05-30 13:25:20 -05:00
parent 0d9a502801
commit b4816c6289
3 changed files with 8 additions and 13 deletions

View file

@ -847,6 +847,13 @@ class MasterView(View):
url = self.request.route_url('vendors.view', uuid=vendor.uuid)
return tags.link_to(text, url)
def valid_vendor_uuid(self, node, value):
if value:
model = self.model
vendor = self.Session.get(model.Vendor, value)
if not vendor:
node.raise_invalid("Vendor not found")
def render_department(self, obj, field):
department = getattr(obj, field)
if not department: