diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index d20493060c3fd..3ca41ea37b73b 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -665,8 +665,8 @@ private function canCreditmemoForZeroTotalRefunded(float $totalRefunded): bool $isRefundZero = abs($totalRefunded) < .0001; // Case when Adjustment Fee (adjustment_negative) has been used for first creditmemo $hasAdjustmentFee = abs($totalRefunded - $this->getAdjustmentNegative()) < .0001; - $hasActinFlag = $this->getActionFlag(self::ACTION_FLAG_EDIT) === false; - if ($isRefundZero || $hasAdjustmentFee || $hasActinFlag) { + $hasActionFlag = $this->getActionFlag(self::ACTION_FLAG_EDIT) === false; + if ($isRefundZero || $hasAdjustmentFee || $hasActionFlag) { return false; } @@ -682,15 +682,15 @@ private function canCreditmemoForZeroTotalRefunded(float $totalRefunded): bool private function canCreditmemoForZeroTotal(float $totalRefunded): bool { $totalPaid = $this->getTotalPaid(); - //check if total paid is less than grandtotal + //check if total paid is less than grand total $checkAmtTotalPaid = $totalPaid <= $this->getGrandTotal(); //case when amount is due for invoice - $dueAmountCondition = $this->canInvoice() && $checkAmtTotalPaid; + $hasDueAmount = $this->canInvoice() && $checkAmtTotalPaid; //case when paid amount is refunded and order has creditmemo created $creditmemos = ($this->getCreditmemosCollection() === false) ? true : (count($this->getCreditmemosCollection()) > 0); $paidAmtIsRefunded = $this->getTotalRefunded() == $totalPaid && $creditmemos; - if (($dueAmountCondition || $paidAmtIsRefunded) + if (($hasDueAmount || $paidAmtIsRefunded) || (!$checkAmtTotalPaid && abs($totalRefunded - $this->getAdjustmentNegative()) < .0001) ) { return false; diff --git a/app/code/Magento/Sales/i18n/en_US.csv b/app/code/Magento/Sales/i18n/en_US.csv index cc18de430edc1..62d8e53e62fa0 100644 --- a/app/code/Magento/Sales/i18n/en_US.csv +++ b/app/code/Magento/Sales/i18n/en_US.csv @@ -796,3 +796,5 @@ Created,Created "PDF Creditmemos","PDF Creditmemos" Refunds,Refunds "Shipment with requested ID %1 doesn't correspond with Order with requested ID %2.","Shipment with requested ID %1 doesn't correspond with Order with requested ID %2." +"Allow Zero GrandTotal for Creditmemo","Allow Zero GrandTotal for Creditmemo" +"Allow Zero GrandTotal","Allow Zero GrandTotal"