MageHawk
MageHawk

Reputation: 51

What are the requirements for showing the credit memo button in the backend of Magento CE 1.9.2.1 for an invoice?

I have got some invoices, that had the wrong state in magento, but the right status "paid" in the payment extension. The reason was a bug in the extension.

So I fixed that by setting the state of these invoices to "2" for paid in sales_flat_invoice and sales_flat_invoice_grid (yes, not the best way to do it...).


Result:

Now the invoices have the right state, they are paid, but there is now button for credit memo available.


Question:

What is missing?

What are the requirements to show up the credit memo button for invoices?


I am using Magento CE 1.9.2.1.

Upvotes: 4

Views: 3338

Answers (2)

For an invoice show the credit memo button inside it, the payment module must save the transaction and have at least $_canRefund as true.

protected $_canRefund = true;
protected $_canRefundInvoicePartial = false;

You can get details in Mage_Sales_Model_Order_Payment::canRefund()

Upvotes: 0

MageHawk
MageHawk

Reputation: 51

Ok now I found the solution on my own.

Concerning the database, I made the following changes for invoices that are paid by payment provider, but have not been proceeded completely by Magento (this only happend, because of an error in the payment extension that broke down the magento process):

sales_flat_invoice:

"state" should get the value "2"

sales_flat_invoice_grid:

"state" should get the value "2"

sales_flat_order:

"base_total_paid" should get the value of "base_total_invoiced"
"total_paid" should get the value of "total_invoiced"
"base_total_due" should get the value "0.0000"
"total_due" should get the value "0.0000"

sales_flat_order_grid:

"base_total_paid" should get the value of "base_grand_total" and not NULL
"total_paid" should get the value of "base_grand_total" and not NULL 

This worked for me, but only to fix the affected invoices.

Don't mess around with the database! ;-)

Upvotes: 1

Related Questions