Invoice ID Column Null in Credit Memo Table
-
12-12-2019 - |
Question
Has anybody else noticed that the invoice_id
column in sales_flat_creditmemo
is always Null?
The order_id
column is populated, but nothing in the invoice_id
column. Is this just me?
Solution
So, I had a quick grep, and in app/code/core/Mage/Adminhtml/Block/Sales/Order/Creditmemo/Create.php
there's this function
public function getHeaderText()
{
if ($this->getCreditmemo()->getInvoice()) {
$header = Mage::helper('sales')->__('New Credit Memo for Invoice #%s', $this->getCreditmemo()->getInvoice()->getIncrementId());
}
else {
$header = Mage::helper('sales')->__('New Credit Memo for Order #%s', $this->getCreditmemo()->getOrder()->getRealOrderId());
}
return $header;
}
This reminded me that there's at least two places you can create a credit memo from, depending on your payment provider.
We use Ebizmarts_Sagepay for most of our orders, and we can create a credit memo from the order, and we can also create a credit memo from the invoice. If we do it from the invoice we'll get the header that says for Invoice #%s
, if we do it from the order we'll get the header that says for Order #%s
.
We also use M2E_Pro and on those order we do a credit memo on the invoice. So I'd guess it depends on whether the payment methods supports refunds.