From 4051d125c2504cac643fd9b1c4fbb00185c5e339 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 9 Aug 2012 09:49:39 -0700 Subject: [PATCH] improve Product view template --- rattail/pyramid/templates/products/crud.mako | 1 - rattail/pyramid/templates/products/read.mako | 44 ++++++++++++++++++++ rattail/pyramid/views/products.py | 5 +++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/rattail/pyramid/templates/products/crud.mako b/rattail/pyramid/templates/products/crud.mako index 1e5ccb97..359d3e8f 100644 --- a/rattail/pyramid/templates/products/crud.mako +++ b/rattail/pyramid/templates/products/crud.mako @@ -1,4 +1,3 @@ -<%inherit file="/products/base.mako" /> <%inherit file="/crud.mako" /> <%def name="context_menu_items()"> diff --git a/rattail/pyramid/templates/products/read.mako b/rattail/pyramid/templates/products/read.mako index 899e025e..07b4f25a 100644 --- a/rattail/pyramid/templates/products/read.mako +++ b/rattail/pyramid/templates/products/read.mako @@ -1,2 +1,46 @@ <%inherit file="/products/crud.mako" /> + +<%def name="head_tags()"> + ${parent.head_tags()} + + + ${parent.body()} + +
+

Product Costs:

+ % if fieldset.model.costs: +
+ + + + + + + + + + + % for i, cost in enumerate(fieldset.model.costs, 1): + + + + + + + + + % endfor + +
Pref.VendorCodeCase SizeCase CostUnit Cost
${'X' if cost.preference == 1 else ''}${cost.vendor}${cost.code}${cost.case_size}${'$ %0.2f' % cost.case_cost if cost.case_cost is not None else ''}${'$ %0.4f' % cost.unit_cost if cost.unit_cost is not None else ''}
+
+ % else: +

None on file.

+ % endif +
diff --git a/rattail/pyramid/views/products.py b/rattail/pyramid/views/products.py index def4e2ac..777a9fcf 100644 --- a/rattail/pyramid/views/products.py +++ b/rattail/pyramid/views/products.py @@ -143,6 +143,9 @@ class ProductCrud(Crud): def fieldset(self, obj): fs = self.make_fieldset(obj) + fs.upc.set(renderer=UpcFieldRenderer) + fs.regular_price.set(renderer=PriceFieldRenderer) + fs.current_price.set(renderer=PriceFieldRenderer) fs.configure( include=[ fs.upc.label("UPC"), @@ -151,6 +154,8 @@ class ProductCrud(Crud): fs.size, fs.department, fs.subdepartment, + fs.regular_price, + fs.current_price, ]) return fs