Exemplo n.º 1
0
    def handle(self, *args, **options):
        proforma = ProformaFactory.create(
            proforma_entries=[DocumentEntryFactory.create()],
            state=Proforma.STATES.ISSUED)
        proforma.create_invoice()

        invoice = InvoiceFactory.create(
            invoice_entries=[DocumentEntryFactory.create()],
            state=Invoice.STATES.ISSUED,
            related_document=None)
        TransactionFactory.create(state=Transaction.States.Settled,
                                  invoice=invoice,
                                  payment_method__customer=invoice.customer,
                                  proforma=None)
        InvoiceFactory.create_batch(
            size=3,
            invoice_entries=[DocumentEntryFactory.create()],
            state=Invoice.STATES.PAID,
            related_document=None)
        InvoiceFactory.create_batch(
            size=3,
            invoice_entries=[DocumentEntryFactory.create()],
            state=Invoice.STATES.DRAFT,
            related_document=None)

        InvoiceFactory.create_batch(
            size=3,
            invoice_entries=[DocumentEntryFactory.create()],
            state=Invoice.STATES.CANCELED,
            related_document=None)
Exemplo n.º 2
0
    def test_invoice_create_storno_from_paid_state(self):
        invoice = InvoiceFactory.create(invoice_entries=[DocumentEntryFactory.create()])
        invoice.issue()
        invoice.pay()
        storno = invoice.create_storno()

        assert -invoice.total == storno.total != 0
        assert storno.related_document == invoice
        assert invoice.customer == storno.customer
        assert invoice.provider == storno.provider