Sorted Ordering Worksheet by brand, description.
This commit is contained in:
parent
bd700431f6
commit
9fabccd7ce
|
@ -104,7 +104,7 @@
|
|||
<th>Pref.</th>
|
||||
<th colspan="14">Order Scratch Pad</th>
|
||||
</tr>
|
||||
% for cost in sorted(costs[dept][subdept], key=lambda x: x.product.description):
|
||||
% for cost in sorted(costs[dept][subdept], key=cost_sort_key):
|
||||
<tr>
|
||||
<td class="upc">${get_upc(cost.product)}</td>
|
||||
<td class="brand">${cost.product.brand or ''}</td>
|
||||
|
|
|
@ -128,10 +128,17 @@ def write_ordering_worksheet(vendor, departments, preferred_only):
|
|||
costs[dept].setdefault(subdept, [])
|
||||
costs[dept][subdept].append(cost)
|
||||
|
||||
def cost_sort_key(cost):
|
||||
product = cost.product
|
||||
brand = product.brand.name if product.brand else ''
|
||||
key = '{0} {1}'.format(brand, product.description)
|
||||
return key
|
||||
|
||||
now = edbob.local_time()
|
||||
data = dict(
|
||||
vendor=vendor,
|
||||
costs=costs,
|
||||
cost_sort_key=cost_sort_key,
|
||||
date=now.strftime('%a %d %b %Y'),
|
||||
time=now.strftime('%I:%M %p'),
|
||||
get_upc=get_upc,
|
||||
|
|
Loading…
Reference in a new issue