4
votes

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.

3
Is the state of the order set to "processing"?Fabian Schmengler
@fschmengler Yes the state and status is set to "processing" in the order tableMageHawk

3 Answers

1
votes

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! ;-)

0
votes

A credit memo button appears only on order description page after an invoice is generated for the same order.i.e. under magento > admin > sales > orders > yourorderno.,

Refer : http://merch.docs.magento.com/ce/user_guide/content/order-processing/credit-memo-create.html

Also try to generate a new order by a regular checkout and then generate an invoice for the same by clicking 'invoice'. Now go back to your order and write us here whether you see credit memo button or not.

0
votes

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()