List active purchase orders for each selected supplier

This commit is contained in:
Oliver Walters 2019-06-13 19:35:38 +10:00
parent 7049ab1d8c
commit 3f809a9001
2 changed files with 9 additions and 0 deletions

View File

@ -37,6 +37,11 @@
id='id_purchase_order_{{ supplier.id }}'
name='purchase_order_{{ supplier.id }}'>
<option value=''>---------</option>
{% for order in supplier.outstanding_purchase_orders %}
<option value='{{ order.id }}'>
{{ order }}
</option>
{% endfor %}
</select>
</div>
</div>

View File

@ -186,6 +186,10 @@ class OrderParts(AjaxView):
supplier.order_items = []
suppliers[supplier.name] = supplier
print("Supplier:", supplier.name)
for order in supplier.outstanding_purchase_orders():
print("order:", order.reference)
suppliers[supplier.name].order_items.append(part)
self.suppliers = [suppliers[key] for key in suppliers.keys()]