Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions app/code/Magento/Sales/Model/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,8 @@ private function canCreditmemoForZeroTotalRefunded($totalRefunded)
$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;
}

Expand All @@ -676,13 +676,12 @@ public function canCreditmemoForZeroTotal($totalRefunded)
//check if total paid is less than grandtotal
$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;
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Sales/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -795,3 +795,5 @@ Created,Created
"PDF Shipments","PDF Shipments"
"PDF Creditmemos","PDF Creditmemos"
Refunds,Refunds
"Allow Zero GrandTotal for Creditmemo","Allow Zero GrandTotal for Creditmemo"
"Allow Zero GrandTotal","Allow Zero GrandTotal"