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

Finalize shipment after inventory units are added to completed order #10

Merged

Conversation

DanielePalombo
Copy link
Member

@DanielePalombo DanielePalombo commented Oct 27, 2017

This PR is going to fix the issue solidusio#2141 .

Create a new class Spree::Stock::InventoryUnitsFinalizer
to finalize the inventory units provided.
It unstocks the desired quantity and marks as not pending the inventory units processed.
To fix the issue we run it, both when a shipment is finalized and when a variant is added to a shipment in a completed order.

@DanielePalombo DanielePalombo changed the base branch from master to add-search-filter-class October 27, 2017 09:38
@DanielePalombo DanielePalombo changed the base branch from add-search-filter-class to master October 27, 2017 09:38
@DanielePalombo DanielePalombo self-assigned this Oct 27, 2017
@DanielePalombo DanielePalombo force-pushed the nebulab/finalize-inventory-units branch 2 times, most recently from 6c73dcb to 21855d1 Compare October 27, 2017 12:21
@DanielePalombo DanielePalombo changed the title Finalize added inventory units for completed order Finalize shipment after inventory units are added to completed order Oct 27, 2017
@DanielePalombo DanielePalombo force-pushed the nebulab/finalize-inventory-units branch 3 times, most recently from 47e7621 to 0046c51 Compare October 27, 2017 14:03
@DanielePalombo DanielePalombo force-pushed the nebulab/finalize-inventory-units branch from 0046c51 to ba65a2d Compare March 16, 2018 13:46
@DanielePalombo DanielePalombo force-pushed the nebulab/finalize-inventory-units branch 4 times, most recently from 51cc0e9 to eb3488e Compare March 16, 2018 15:42
@DanielePalombo DanielePalombo force-pushed the nebulab/finalize-inventory-units branch from eb3488e to 187a260 Compare March 30, 2018 13:01
@DanielePalombo DanielePalombo force-pushed the nebulab/finalize-inventory-units branch from 187a260 to c9367a8 Compare April 20, 2018 08:32
jacobherrington and others added 11 commits September 26, 2018 18:33
It is important that the documentation shows
a proper example of namespacing promotion
actions.
I have come across a use case in which the product's sku attribute needs to be
editable by the admin even in the event that the product has variants. This
commit adds a user interface element for a Master SKU which updates the
Spree::Product's sku attribute. It is visible regardless of the number of
variants, which satisfies my use case.
The old name wasn't that explicit about what it is testing
Let users explicitly create a new code on an existing promotion,
without checking if it's a "single" or "multiple" promotion type
because it's already possible do switch from a "single" to "multiple"
using the `Spree::PromotionCodeBatch` creation process.

This let the user creates a new code without using the "batch" method
so that it can explicitly choose a new code without using random
suffixes.
`.full_messages.to_sentence` will do the same as
`.full_messages.join(', ')` but uses an "and" as last divider
stem and others added 28 commits October 31, 2018 17:31
This applies only to some deprecated blocks and does not
change the new, working logic.

This means that if those methods were used by some store or
extension, they will now don't have the creator set instead
of having a specific user that could even be not present in the
database, causing the creator to be nil anyway.
Otherwise people coming from the website will be confused about where the
doc sources are hosted.

The link now points to the README inside guides/, to which this commit adds
an introductory paragraph with further guidance.
Using `prepend self` avoids repetition and potential errors coming from copy/paste.
Reducing the module nesting makes it less prone to mis-referencing constants by
skipping the namespace, requiring a the qualified reference to be used instead.
…address-dependency

Remove default address dependency part 2
…s-docs

improve decorators / contributing docs
remove unused routes and actions from return authorizations
Remove broken links, add Yarn and remove Gulp, which does not
seem to be used
This is needed for a security issue:

CVE-2017-16028

Vulnerable versions: < 3.0.0
Patched version: 3.0.0

https://nvd.nist.gov/vuln/detail/CVE-2017-16028
In latest Twitter Bootstrap versions form-control height is
no more auto and this change is needed to make our search
bar work properly, see: twbs/bootstrap#26820
…tegory_index_exception

symbol can't be argument for :count in east slavic locales
…omotion-actions

Update promotion actions documentation
Create a new promotion code inside an existing promotion
…ze-field-label

Add missing yml for label
…er-over-search

Use filter over search for filter options
…product-sku

Add a Master SKU field to the products form
Spree::Stock::InventoryUnitsFinalizer is responsible to:

- Unstock the desired quantity
- Update the inventory units to not pending

The finalize logic inside the `run!` method has been taken from
https://github.com/solidusio/solidus/blob/64bb34aa5837bca0580002d608358b0826d94ae6/core/app/models/spree/shipment.rb#L167-L172
While inventory units are being add to the shipment, collect and
finalize them if the order is completed.
Added `finalize_pending_inventory_units` method that is responsible to
finalize just pending inventory units.
@vassalloandrea vassalloandrea merged commit 98cbf42 into nebulab:master Dec 12, 2018
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.

None yet

9 participants