Improve default behavior for receiving a purchase batch

only targeting desktop so far, mobile is next...
This commit is contained in:
Lance Edgar 2018-05-03 18:15:13 -05:00
parent e6144ea08b
commit a5d1eece71
3 changed files with 151 additions and 42 deletions

View file

@ -310,6 +310,17 @@ class PurchaseView(MasterView):
# department
f.set_renderer('department', self.render_row_department)
# product
f.set_renderer('product', self.render_row_product)
def render_row_product(self, row, field):
product = row.product
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 render_row_department(self, row, field):
return "{} {}".format(row.department_number, row.department_name)