magento-lts icon indicating copy to clipboard operation
magento-lts copied to clipboard

[BUG] Order State set to complete with multiple Invoices

Open Hanmac opened this issue 8 months ago • 0 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Current Behavior

The order is set to complete, even if one of the invoices isn't paid

Expected Behavior

The Order should not be complete yet

Steps To Reproduce

Have an Order with two Products: Product A, and Product B

Then use a Payment method, that creates an Invoice, but doesn't directly pay it. (like Gateway methods?) Create separate Invoices for A and for B.

Now mark one of the Invoices as Paid, but not the other.

Code piece from _checkState:

https://github.com/OpenMage/magento-lts/blob/394662b323cc75b344a24918e025e3655411c857/app/code/core/Mage/Sales/Model/Order.php#L2389-L2397

Code piece from canCreditmemo:

https://github.com/OpenMage/magento-lts/blob/394662b323cc75b344a24918e025e3655411c857/app/code/core/Mage/Sales/Model/Order.php#L742-L744

Because there are invoices for all Products A and B, and getTotalPaid is greater than 0.0001, the whole Order is complete, even if only one invoice is paid.

Environment

- OpenMage: 20.*
- php: 8.1

Anything else?

I'm not 100% sure if that is a bug or wanted behavior

Hanmac avatar Apr 28 '25 14:04 Hanmac