When creating a credit memo in Magento one has the option to return stock managed products to stock.
How can one tell – by looking at an existing credit memo – whether or not the admin decided to return any units to stock?
I've looked at the backend & the table structure and this information is seemingly not visible anywhere.
Any ideas?
Best Answer
The information about the return to stock is not kept in the database.
When a credit memo is created the method
Mage_CatalogInventory_Model_Observer::refundOrderInventory()
is called.In there an array is built with the qtys that need to return to stock based on the fact that the creditmemo item was previously marked with
setBackToStock(true)
or if the config setting for returning refunded products to stock is set toYes
.Then the method
Mage_CatalogInventory_Model_Stock::revertProductsSale()
is called with a parameter consisting of the array built from the item qtys. This method is just a wrapper forMage_CatalogInventory_Model_resource_Stock::correctItemsQty()
that actually runs the queries and updates the product stock.But there is no code (or table field) that remembers if the qty was returned to stock or not.