Error :: canReturnItemToStock() or canParentReturnToStock()..

Posted: September 8, 2010 in Magento, Version 1.3.*
Tags: ,

I got this error while credit memo ..
So i have placed this two function in
Mage/Adminhtml/Block/Sales/Items/Abstract.php

Here is the functions..
public function canReturnItemToStock($item=null) {
$canReturnToStock = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_CAN_SUBTRACT);
if (!is_null($item)) {
if (!$item->hasCanReturnToStock()) {
$product = Mage::getModel(‘catalog/product’)->load($item->getOrderItem()->getProductId());
if ( $product->getId() && $product->getStockItem()->getManageStock() ) {
$item->setCanReturnToStock(true);
}
else {
$item->setCanReturnToStock(false);
}
}
$canReturnToStock = $item->getCanReturnToStock();
}
return $canReturnToStock;
}

public function canParentReturnToStock($item = null)
{
$canReturnToStock = Mage::getStoreConfig(Mage_CatalogInventory_Model_Stock_Item::XML_PATH_CAN_SUBTRACT);
if (!is_null($item)) {
if ( $item->getCreditmemo()->getOrder()->hasCanReturnToStock() ) {
$canReturnToStock = $item->getCreditmemo()->getOrder()->getCanReturnToStock();
}
} elseif ( $this->getOrder()->hasCanReturnToStock() ) {
$canReturnToStock = $this->getOrder()->getCanReturnToStock();
}
return $canReturnToStock;
}

I hope this will helpful….
Bijal Bhavsar 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s