'update requested qty (before ordered_qty is updated)'

def update_ordered_qty(self, po_item_rows=None):

    item_wh_list = []
    for d in self.get(u'items'):
        if (((not po_item_rows) or (d.name in po_item_rows)) and ([d.item_code, d.warehouse] not in item_wh_list) and frappe.db.get_value(u'Item', d.item_code, u'is_stock_item') and d.warehouse and (not d.delivered_by_supplier)):
            item_wh_list.append([d.item_code, d.warehouse])
    for (item_code, warehouse) in item_wh_list:
        update_bin_qty(item_code, warehouse, {u'ordered_qty': get_ordered_qty(item_code, warehouse)})
