Sorted Ordering Worksheet by brand, description.
This commit is contained in:
parent
bd700431f6
commit
9fabccd7ce
|
@ -104,7 +104,7 @@
|
||||||
<th>Pref.</th>
|
<th>Pref.</th>
|
||||||
<th colspan="14">Order Scratch Pad</th>
|
<th colspan="14">Order Scratch Pad</th>
|
||||||
</tr>
|
</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>
|
<tr>
|
||||||
<td class="upc">${get_upc(cost.product)}</td>
|
<td class="upc">${get_upc(cost.product)}</td>
|
||||||
<td class="brand">${cost.product.brand or ''}</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].setdefault(subdept, [])
|
||||||
costs[dept][subdept].append(cost)
|
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()
|
now = edbob.local_time()
|
||||||
data = dict(
|
data = dict(
|
||||||
vendor=vendor,
|
vendor=vendor,
|
||||||
costs=costs,
|
costs=costs,
|
||||||
|
cost_sort_key=cost_sort_key,
|
||||||
date=now.strftime('%a %d %b %Y'),
|
date=now.strftime('%a %d %b %Y'),
|
||||||
time=now.strftime('%I:%M %p'),
|
time=now.strftime('%I:%M %p'),
|
||||||
get_upc=get_upc,
|
get_upc=get_upc,
|
||||||
|
|
Loading…
Reference in a new issue