Ejemplo n.º 1
0
def create_proforma_invoice(sender, instance, created, **kwargs):
    """
    For every Order if there are defined billing_data creates invoice proforma,
    which is an order confirmation document
    """
    if created:
        try:
            billing_info = BillingInfo.objects.get(user=instance.user)
        except BillingInfo.DoesNotExist:
            return

        day = date.today()
        invoice = Invoice(issued=day, selling_date=day, payment_date=day + timedelta(days=14))
        invoice.type = Invoice.INVOICE_TYPES['PROFORMA']
        invoice.copy_from_order(instance)
        invoice.set_issuer_invoice_data()
        invoice.set_buyer_invoice_data(billing_info)
        invoice.clean()
        invoice.save()
Ejemplo n.º 2
0
 def test_get_full_number_type3(self):
     i = Invoice()
     i.type = Invoice.INVOICE_TYPES.PROFORMA
     i.number = 123
     i.issued = date(2010, 5, 30)
     self.assertEqual(i.get_full_number(), "123/PF/05/2010")
Ejemplo n.º 3
0
 def test_get_full_number_type2(self):
     i = Invoice()
     i.type = Invoice.INVOICE_TYPES.DUPLICATE
     i.number = 123
     i.issued = date(2010, 5, 30)
     self.assertEqual(i.get_full_number(), "123/FV/05/2010")
Ejemplo n.º 4
0
 def test_get_full_number_type3(self):
     i = Invoice()
     i.type = Invoice.INVOICE_TYPES.PROFORMA
     i.number = 123
     i.issued = date(2010, 5, 30)
     self.assertEqual(i.get_full_number(), "123/PF/05/2010")
Ejemplo n.º 5
0
 def test_get_full_number_type2(self):
     i = Invoice()
     i.type = Invoice.INVOICE_TYPES.DUPLICATE
     i.number = 123
     i.issued = date(2010, 5, 30)
     self.assertEqual(i.get_full_number(), "123/FV/05/2010")