Possible solution:
In order to create a 'pending' invoice, the payment method you use for the order must allow you to.
For that you need to add in the payment method's model this member:
protected $_canCapture = true;You can add it right under
protected $_code = 'PAYMENT CODE HERE';For example if you want to do this for Check/money order you need to add the line above in app/code/core/Mage/Payment/Model/Method/Checkmo.php
After this when you create an invoice you will have an option near the save button to set the invoice status. (see picture attached). To create a pending invoice select 'Not capture'.
If you want to mark it later as paid edit the invoice and between the buttons on to one called 'Capture' (see picture). Well you get the idea....
Thank you so much for sharing this info. It was a real lifesaver.
ReplyDeleteHey. Great info. But can this be done without changing core stuff (so that you can still update)? Like overriding the model in /app/code/local?
ReplyDeleteHello Dakira. Yes you can. You can override the payment method model just like any other model (or block or helper) and add the line I suggested in your class.
ReplyDeleteCan i also use it in magento 1.5?
ReplyDeleteYes. Try it.
ReplyDeleteYou saved my day ;)
ReplyDeleteShould this also work for pre-existing invoices, or only invoices created as 'pending' after applying this override?
ReplyDeleteHello.
DeleteIt works only for invoices created after applying the update.
Marius.
You know, if real accountants had been consulted on purchase order processing by the geeks who wrote this sorry stuff, it would not be necessary to tweak it like this. Obviously, the programmers who wrote this do not have to deal with invoicing. Since when is an invoice 'paid' just because it was printed or emailed?? How is a store owner expected to know what is due if all invoices are marked 'paid'?? Another downside to Magento....
ReplyDeleteYeah... I even put in a suggestion about changing this.
DeleteOf course, their canned response was "the invoice is a receipt."
?!?!? WTF ?!?!?
They obviously have not looked up the definition of invoice. LOL
how can i do this programetically ? that is create invoice with pending staus.
ReplyDeleteI didn't try this before, but you can try to simulate how the invoice is created in the controller. Add some debug lines in the 'Mage_Adminhtml_Sales_Order_InvoiceController::saveAction' method, see what data is sent by POST and how the invoice is created and do the same in your custom code.
DeleteCE version 1.8.1
ReplyDeleteFatal error: Multiple access type modifiers are not allowed in /home/arplanst/public_html/crm/includes/src/Mage_Payment_Model_Method_Checkmo.php on line 33
Fatal error: Multiple access type modifiers are not allowed in /home/arplanst/public_html/crm/includes/src/Mage_Payment_Model_Method_Checkmo.php on line 33
ReplyDeleteOops... I put a # instead of $
Yes i try this. and i think its work fine in fresh magento.
ReplyDeleteI am using extension for one page checkout and because of this its not work for me.
but i have update "protected $_canCapture = false; to "protected $_canCapture = true;" on /var/www/surpriseforu/public_html/app/code/core/Mage/Payment/Model/Method/Abstract.php path. and its work fine for me..
Thanks,
Rakesh Patel.
I know it is five years since this was posted, and it works great. But is it possible to only allow the Option "Not Capture" and remove the other options for the same payment method.
ReplyDeleteThanks Jethro
I have used code protected $_canCapture = true; in Cash on delivery payment method, in order to generate invoice with payment status pending to either capture payment when amount is paid or cancel invoice when payment is not done. When payment is not done, I am able to cancel invoice and then cancel order. Doing this, not increase stock Qty of the items in the order.
ReplyDelete