Skip to content

Commit

Permalink
MAGETWO-91769: Credit Memo - Wrong tax calculation! #10982
Browse files Browse the repository at this point in the history
- Converting base order shipping amount for correct calculation;
  • Loading branch information
Alexey Yakimovich committed Nov 1, 2018
1 parent bb65b43 commit 39dfb2b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/code/Magento/Sales/Model/Order/Creditmemo/Total/Tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ public function collect(\Magento\Sales\Model\Order\Creditmemo $creditmemo)
}

$isPartialShippingRefunded = false;
$baseOrderShippingAmount = (float)$order->getBaseShippingAmount();
if ($invoice = $creditmemo->getInvoice()) {
//recalculate tax amounts in case if refund shipping value was changed
if ($order->getBaseShippingAmount() && $creditmemo->getBaseShippingAmount() !== null) {
$taxFactor = $creditmemo->getBaseShippingAmount() / $order->getBaseShippingAmount();
if ($baseOrderShippingAmount && $creditmemo->getBaseShippingAmount() !== null) {
$taxFactor = $creditmemo->getBaseShippingAmount() / $baseOrderShippingAmount;
$shippingTaxAmount = $invoice->getShippingTaxAmount() * $taxFactor;
$baseShippingTaxAmount = $invoice->getBaseShippingTaxAmount() * $taxFactor;
$totalDiscountTaxCompensation += $invoice->getShippingDiscountTaxCompensationAmount() * $taxFactor;
Expand All @@ -104,7 +105,6 @@ public function collect(\Magento\Sales\Model\Order\Creditmemo $creditmemo)
}
} else {
$orderShippingAmount = $order->getShippingAmount();
$baseOrderShippingAmount = $order->getBaseShippingAmount();

$baseOrderShippingRefundedAmount = $order->getBaseShippingRefunded();

Expand Down

0 comments on commit 39dfb2b

Please sign in to comment.