Tweak how vendor link is rendered for readonly field
This commit is contained in:
parent
797a65e9c8
commit
b3867d9c89
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2020 Lance Edgar
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -953,8 +953,9 @@ class MasterView(View):
|
|||
vendor = getattr(obj, field)
|
||||
if not vendor:
|
||||
return ""
|
||||
if vendor.id:
|
||||
text = "({}) {}".format(vendor.id, vendor.name)
|
||||
short = vendor.id or vendor.abbreviation
|
||||
if short:
|
||||
text = "({}) {}".format(short, vendor.name)
|
||||
else:
|
||||
text = six.text_type(vendor)
|
||||
url = self.request.route_url('vendors.view', uuid=vendor.uuid)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2020 Lance Edgar
|
||||
# Copyright © 2010-2021 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -409,14 +409,6 @@ class PurchasingBatchView(BatchMasterView):
|
|||
url = self.request.route_url('purchases.view', uuid=purchase.uuid)
|
||||
return tags.link_to(text, url)
|
||||
|
||||
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 render_vendor_email(self, batch, field):
|
||||
if batch.vendor.email:
|
||||
return batch.vendor.email.address
|
||||
|
|
Loading…
Reference in a new issue