Add common logic to validate employee reference field
This commit is contained in:
parent
ec7b0cdda1
commit
d504da19c5
|
@ -856,6 +856,13 @@ class MasterView(View):
|
||||||
url = self.request.route_url('stores.view', uuid=store.uuid)
|
url = self.request.route_url('stores.view', uuid=store.uuid)
|
||||||
return tags.link_to(text, url)
|
return tags.link_to(text, url)
|
||||||
|
|
||||||
|
def valid_employee_uuid(self, node, value):
|
||||||
|
if value:
|
||||||
|
model = self.model
|
||||||
|
employee = self.Session.get(model.Employee, value)
|
||||||
|
if not employee:
|
||||||
|
node.raise_invalid("Employee not found")
|
||||||
|
|
||||||
def render_product(self, obj, field):
|
def render_product(self, obj, field):
|
||||||
product = getattr(obj, field)
|
product = getattr(obj, field)
|
||||||
if not product:
|
if not product:
|
||||||
|
|
Loading…
Reference in a new issue