'Generates the pdf receipt for the given order_items
and returns the pdf_buffer.'

def generate_pdf_receipt(self, order_items):

    items_data = []
    for item in order_items:
        item_total = (item.qty * item.unit_cost)
        items_data.append({'item_description': item.pdf_receipt_display_name, 'quantity': item.qty, 'list_price': item.get_list_price(), 'discount': (item.get_list_price() - item.unit_cost), 'item_total': item_total})
    pdf_buffer = BytesIO()
    PDFInvoice(items_data=items_data, item_id=str(self.id), date=self.purchase_time, is_invoice=False, total_cost=self.total_cost, payment_received=self.total_cost, balance=0).generate_pdf(pdf_buffer)
    return pdf_buffer
