Add MasterView.render_product(), fix edit for pricing batch row

This commit is contained in:
Lance Edgar 2018-10-23 17:20:47 -05:00
parent b9da7e1b12
commit 2bd107056c
7 changed files with 30 additions and 35 deletions

View file

@ -731,6 +731,14 @@ class MasterView(View):
return obj.upc.pretty() if obj.upc else ''
return getattr(obj, product_key)
def render_product(self, obj, field):
product = getattr(obj, field)
if not product:
return ""
text = six.text_type(product)
url = self.request.route_url('products.view', uuid=product.uuid)
return tags.link_to(text, url)
def before_create_flush(self, obj, form):
pass