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
10 changes: 5 additions & 5 deletions app/code/Magento/Sales/Model/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
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 @@ -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"