Misc. tweaks to vendor catalog views

for sake of titeship
This commit is contained in:
Lance Edgar 2020-10-23 22:08:43 -05:00
parent ee3d32d60a
commit 3cd5fa7f4a
3 changed files with 15 additions and 9 deletions

View file

@ -0,0 +1,11 @@
## -*- coding: utf-8; -*-
<%inherit file="/batch/index.mako" />
<%def name="context_menu_items()">
${parent.context_menu_items()}
% if request.has_perm('vendors.list'):
<li>${h.link_to("View Vendors", url('vendors'))}</li>
% endif
</%def>
${parent.body()}

View file

@ -186,14 +186,6 @@ class VendorCatalogsView(FileBatchMasterView):
if not self.creating: if not self.creating:
f.set_readonly('effective') f.set_readonly('effective')
def render_vendor(self, batch, field):
vendor = batch.vendor
if not vendor:
return ""
text = "({}) {}".format(vendor.id, vendor.name)
url = self.request.route_url('vendors.view', uuid=vendor.uuid)
return tags.link_to(text, url)
def get_batch_kwargs(self, batch): def get_batch_kwargs(self, batch):
kwargs = super(VendorCatalogsView, self).get_batch_kwargs(batch) kwargs = super(VendorCatalogsView, self).get_batch_kwargs(batch)
kwargs['parser_key'] = batch.parser_key kwargs['parser_key'] = batch.parser_key

View file

@ -928,7 +928,10 @@ class MasterView(View):
vendor = getattr(obj, field) vendor = getattr(obj, field)
if not vendor: if not vendor:
return "" return ""
text = "({}) {}".format(vendor.id, vendor.name) if vendor.id:
text = "({}) {}".format(vendor.id, vendor.name)
else:
text = six.text_type(vendor)
url = self.request.route_url('vendors.view', uuid=vendor.uuid) url = self.request.route_url('vendors.view', uuid=vendor.uuid)
return tags.link_to(text, url) return tags.link_to(text, url)