Skip to content

Commit e3a8af6

Browse files
authored
Update Invoice.php
you can't cancel invoice if state == paid, If state == paid, you can do the credit memo. When you create an invoice and realise that it needs to be cancelled, be aware that there are some legal restrictions involved. Technically, you should never delete an issued invoice but instead use a credit note to cancel the invoice.
1 parent 076ec45 commit e3a8af6

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

app/code/Magento/Sales/Model/Order/Invoice.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,6 @@ public function cancel()
445445
$order->setBaseDiscountInvoiced($order->getBaseDiscountInvoiced() - $this->getBaseDiscountAmount());
446446
$order->setBaseTotalInvoicedCost($order->getBaseTotalInvoicedCost() - $this->getBaseCost());
447447

448-
if ($this->getState() == self::STATE_PAID) {
449-
$order->setTotalPaid($order->getTotalPaid() - $this->getGrandTotal());
450-
$order->setBaseTotalPaid($order->getBaseTotalPaid() - $this->getBaseGrandTotal());
451-
}
452448
$this->setState(self::STATE_CANCELED);
453449
$order->setState(\Magento\Sales\Model\Order::STATE_PROCESSING)
454450
->setStatus($order->getConfig()->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_PROCESSING));

0 commit comments

Comments
 (0)