2

I was testing various scenarios creating invoices and capturing them. I am using EE 1.13.1.0, and I noticed a strange behavior where if I do the following, the subtotal is doubled from the original ordered item list. [Update: I now know why this is happening. Please see the end of the post.]

  1. Submit an order through authorize.net in test mode with authorize-only mode.
  2. Create an invoice using the API and nothing more.

    i.e. $invoice = Mage::getModel('sales/order_invoice_api')->create($orderIncrementId, array());

  3. Ship all of the order items.

  4. Go to the admin, and cancel the pending invoice.
  5. Create another invoice
  6. Check out the subtotal. My instance always doubles the subtotal, tax, etc, and it cannot be modified in the second time creating the invoice.

UPDATE 1:

This is happening because when the API method is called to create the invoice and the process ends there, the sales_flat_order table's *_invoiced entries are not updated. When a non-capturing invoice is created, sales_flat_order's *_invoiced are updated.

Subsequently, when canceling this pending invoice, sales_flat_order is updated (subtracted) to reset values in *_invoiced. This is causing the negative dollar amounts in this table and causing problems when I try to re-invoice the order. I'm gonna try a couple more things and post an update here.

Update 2:

I've resolved this problem, and it was due to a logic problem and not inherently related to the core functions. I'll update my answer later.

4
  • Interesting. I suggest you file a bug with magento support, since you pay for that ;) If they come back with a result, you could update the answer.
    – ProxiBlue
    Commented Jan 14, 2014 at 2:53
  • I think it may have to do with the incorrect use of the functions. I'm going to try something and post an update.
    – laketuna
    Commented Jan 14, 2014 at 17:50
  • @laketuna could you share what the problem was? Commented May 20, 2014 at 15:22
  • @laketuna - please move your solution into an answer and mark it as "accepted". It won't get you points, and isn't something you should do often, but it's the right way to self-answer a question. Thanks!
    – STW
    Commented Oct 1, 2014 at 20:54

1 Answer 1

1

As I recall, this was a problem of a method processing invoices for the same order in different ways. It was creating two separate invoices and save them separately, causing inconsistencies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.