def METHOD_NAME(self):
    if self.is_storno:
        raise ValueError("This invoice is already a storno one.")
    if self.state not in [self.STATES.CANCELED, self.STATES.PAID]:
        raise ValueError(
            "The invoice state must either be canceled or paid in order to create a storno."
        )
    with transaction.atomic():
        storno_invoice = Invoice.objects.create(
            related_document=self,
            provider=self.provider,
            customer=self.customer,
            is_storno=True,
            sales_tax_name=self.sales_tax_name,
            sales_tax_percent=self.sales_tax_percent,
            currency=self.currency,
            transaction_currency=self.transaction_currency,
            transaction_xe_date=self.transaction_xe_date,
            transaction_xe_rate=self.transaction_xe_rate,
        )
        storno_invoice.invoice_entries.add(*[DocumentEntry.objects.create(
            description="Storno " + entry.description,
            unit_price=-entry.unit_price,
            unit=entry.unit,
            quantity=entry.quantity,
            product_code=entry.product_code,
            start_date=entry.start_date,
            end_date=entry.end_date,
            prorated=entry.prorated,
            invoice=storno_invoice,
        ) for entry in self.entries])
        return storno_invoice