Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canceled invoice can be canceled again #9968

Closed
redelschaap opened this issue Jun 16, 2017 · 7 comments
Closed

Canceled invoice can be canceled again #9968

redelschaap opened this issue Jun 16, 2017 · 7 comments
Assignees
Labels
bug report Component: Sales Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@redelschaap
Copy link
Contributor

A canceled invoice can be canceled again. I think \Magento\Sales\Model\Order\Invoice::cancel should check whether the invoice can be canceled before executing all cancel operations.

Preconditions

  1. Tested on Magento 2.1.5

Steps to reproduce

  1. Load a canceled invoice programmatically
  2. Call $invoice->cancel()

Expected result

  1. Throw an exception saying the invoice has already been canceled.

Actual result

  1. The invoice gets canceled twice, so order amounts are also being adjusted twice.
@magento-engcom-team magento-engcom-team added 2.1.x bug report Component: Sales Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Sep 20, 2017
@okorshenko okorshenko added Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Sep 21, 2017
@magento-engcom-team
Copy link
Contributor

@redelschaap, thank you for your report.
We've created internal ticket(s) MAGETWO-75779 to track progress on the issue.

@osrecio
Copy link
Member

osrecio commented Sep 26, 2017

Maybe Adding a Guard Clause in \Magento\Sales\Model\Order\Invoice::cancel with:

public function cancel()
{
        if (!$this->canCancel()) {
            return $this;
        }
       ...
}

can Solve the problem.

If you accept this solution @okorshenko @magento-engcom-team @veloraven can proceed to create PR.

@okorshenko
Copy link
Contributor

We need to backport this into 2.2-develop

@osrecio
Copy link
Member

osrecio commented Oct 3, 2017

Working on it

@osrecio
Copy link
Member

osrecio commented Oct 5, 2017

Created 2.2-develop Backport @okorshenko

@magento-engcom-team magento-engcom-team added 2.2.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Oct 11, 2017
@magento-engcom-team magento-engcom-team added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Oct 11, 2017
@okorshenko
Copy link
Contributor

Hi @redelschaap the issue has been fixed in 2.2-develop branch and will be available in 2.2.2 soon

@okorshenko okorshenko added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Oct 17, 2017
@okorshenko
Copy link
Contributor

Hi @redelschaap the issue has been fixed in 2.2-develop branch and will be available in 2.2.2 soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Sales Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

5 participants