-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fix for reverting stock twice for cancelled orders #12668
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
Conversation
Hi @dverkade , we are discussing internally the best way to solve related issue, I will keep you updated |
Hi again @dverkade , it seems that reverting stock is performed twice due to wrong event legacy observer in
Reverting quote inventory should be responsibility either of This should solve the problem without hardcoding and tying order states to available states to revert the stock, as at some point there could be more valid states to revert the stock, and order state does not necessarily defines if a quote item inventory can be reverted or not. My suggestion is revert the applied changes and remove |
Hi @adrian-martinez-interactiv4, Thank you for your feedback. I have reverted the commits and took a look at the restore_quote event observer. This event is called when Magento needs to create a new quote with a different quote_id from an order. Nothing happens to the status of the original order, so we should not update the inventory at that moment. So I have removed this event observer from the code. I did not change it to paypal_payment_cancel, since this is event is never dispatched and a paypal event observer should be placed within the paypal module not in the cataloginventory module. |
Hi @dverkade , the |
…tock twice for cancelled orders #12949
Accepted Public Pull Requests: - magento-engcom/magento2ce#1195: Ability to switch to default mode[forwardport]. (by @nmalevanec) - magento-engcom/magento2ce#1193: Format generated config files using the short array syntax[forwardport]. (by @nmalevanec) - #13012: [Port to 2.3-develop] Add trim filter to first, middle and lastname. (by @wardcapp) - #12949: [Backport #12668 into 2.3-develop] Fix for reverting stock twice for cancelled orders (by @dverkade) Fixed GitHub Issues: - #4292: Why can't one switch back to default mode ? (reported by @digitalpianism) has been fixed in magento-engcom/magento2ce#1195 by @nmalevanec in 2.3-develop branch Related commits: 1. 3967190 - #758: Coding standards: arrays (reported by @tzyganu) has been fixed in magento-engcom/magento2ce#1193 by @nmalevanec in 2.3-develop branch Related commits: 1. 6d86db1 - #10415: Customer First and Last names not being trimmed of leading and trailing spaces on save. (reported by @spyrule) has been fixed in #13012 by @wardcapp in 2.3-develop branch Related commits: 1. e8dad7a 2. 9a45695 3. 03f250a - #9969: Cancel order and restore quote methods increase stocks twice (reported by @simpleadm) has been fixed in #12949 by @dverkade in 2.3-develop branch Related commits: 1. 1055076
…tock twice for cancelled orders #12952
Accepted Public Pull Requests: - #12954: [Backport to 2.1-develop] Fix #2156 Js\Dataprovider uses the RendererInterface. (by @dverkade) - #12952: [Backport #12668 into 2.1-develop] Fix for reverting stock twice for cancelled orders (by @dverkade) Fixed GitHub Issues: - #2156: Why does \Magento\Translation\Model\Js\DataProvider use \Magento\Framework\Phrase\Renderer\Translate, not \Magento\Framework\Phrase\Renderer\Composite? (reported by @dmitry-fedyuk) has been fixed in #12954 by @dverkade in 2.1-develop branch Related commits: 1. 65c99b9 2. f215350 3. a0b7bc5 - #9969: Cancel order and restore quote methods increase stocks twice (reported by @simpleadm) has been fixed in #12952 by @dverkade in 2.1-develop branch Related commits: 1. bbe2f1a 2. b5b59be
Description
Fix for reverting stock twice for cancelled orders:
restore_quote
, that increased the stock when rebuilding a quote. Reverting quote inventory should be responsibility either ofsales_model_service_quote_submit_failure
orsales_order_item_cancel
events;Fixed Issues