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

fix double deduction and per-website conditional enable noreservation #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

davebra
Copy link

@davebra davebra commented Jan 23, 2020

BUGFIX (commit #7772121): stock and source qty deducted twice

The event "sales_order_invoice_save_after" which call the observer SourceDeductionProcessor in some case is fired twice, causing double deduction of stock+source.

The fix consists in:

  • session variable created at the first execution if the deduction in the observer, the observer check the existance of this session before execution.

NEW FEATURE (commit #686897c): per-website enable/disable NoReservation

The module disable NoReservation globally, but in some case would be necessary to have it disabled for some websites only. This add a configuration page under Store -> Configuration -> Catalog -> MSI No Reservations
The feature consists in:

  • rename observer SourceDeductionProcessor to InvoiceSourceDeductionProcessor (meaningful name)
  • per-website conditional execution for InvoiceSourceDeductionProcessor
  • replace observer SourceDeductionProcessor for event sales_order_shipment_save_after with ShippingSourceDeductionProcessor
  • per-website conditional execution for ShippingSourceDeductionProcessor
  • replace plugin AppendReservationsAfterOrderPlacementPlugin
  • per-website conditional execution for AppendReservationsAfterOrderPlacementPlugin
  • removed around plugin on PlaceReservationsForSalesEventPlugin (execution is avoided in AppendReservationsAfterOrderPlacementPlugin)

Execution for order on website with setting enabled

order creation

  1. Observer InvoiceSourceDeductionProcessor STARTED
  2. Observer InvoiceSourceDeductionProcessor EXECUTED (stock + source deduction)
  3. Plugin AppendReservationsAfterOrderPlacementPlugin STARTED
  4. Observer InvoiceSourceDeductionProcessor STARTED (twice issue)

shipment creation

  1. Observer ShippingSourceDeductionProcessor STARTED

Execution for order on website with setting disabled

order creation

  1. Observer InvoiceSourceDeductionProcessor STARTED
  2. Plugin AppendReservationsAfterOrderPlacementPlugin STARTED
  3. Plugin AppendReservationsAfterOrderPlacementPlugin EXECUTED (add reservation)
  4. Observer InvoiceSourceDeductionProcessor STARTED (twice issue)

shipment creation

  1. Observer ShippingSourceDeductionProcessor STARTED
  2. Observer ShippingSourceDeductionProcessor EXECUTED (source deduction + remove reservation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant