I am studying this problem and it seems to be a rounding problem. After creating a credit memo, the order status should be closed, but in my case, some returned orders retained their original status.
When creating a credit memo, two functions Mage_Sales_Model_Order::canCreditmemo() and Mage_Sales_Model_Order_Invoice::canRefund() called. They both return false if the difference between the total amount and the recoverable amount is less than 0.0001.
In my testing, this was not the case for some returned orders, regardless of the payment method used. Increasing the value to 0.001 in both functions led to a closed order status. This also explains why only some orders retain their status, and some close correctly depending on the price and amount of tax.
I solved the problem by overriding the main Magento classes in local and replacing the following lines as follows:
Mage_Sales_Model_Order:
if (abs($this->getStore()->roundPrice($this->getTotalPaid()) - $this->getTotalRefunded()) < .001) { return false; }
Mage_Sales_Model_Order_Invoice:
if (abs($this->getBaseGrandTotal() - $this->getBaseTotalRefunded()) < .001) { return false; }
I hope this helps others because it took me a while to track down this error.
Jan knipper
source share