From b3867d9c89d91948182160d6c68e698ce338066c Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 27 Jan 2021 22:24:23 -0600 Subject: [PATCH] Tweak how vendor link is rendered for readonly field --- tailbone/views/master.py | 7 ++++--- tailbone/views/purchasing/batch.py | 10 +--------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/tailbone/views/master.py b/tailbone/views/master.py index 79f537e0..be67eaa5 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -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) diff --git a/tailbone/views/purchasing/batch.py b/tailbone/views/purchasing/batch.py index e8bc5ba7..d83beb6f 100644 --- a/tailbone/views/purchasing/batch.py +++ b/tailbone/views/purchasing/batch.py @@ -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