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 }}' id='id_purchase_order_{{ supplier.id }}'
name='purchase_order_{{ supplier.id }}'> name='purchase_order_{{ supplier.id }}'>
<option value=''>---------</option> <option value=''>---------</option>
{% for order in supplier.outstanding_purchase_orders %}
<option value='{{ order.id }}'>
{{ order }}
</option>
{% endfor %}
</select> </select>
</div> </div>
</div> </div>

View File

@ -185,6 +185,10 @@ class OrderParts(AjaxView):
if not supplier.name in suppliers: if not supplier.name in suppliers:
supplier.order_items = [] supplier.order_items = []
suppliers[supplier.name] = supplier 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) suppliers[supplier.name].order_items.append(part)