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

WIP: Order not triggering callbacks on shipments #2065

Closed
wants to merge 1 commit into from

Conversation

skukx
Copy link
Contributor

@skukx skukx commented Jul 6, 2017

When complete! is called on order, it then updates all the shipments
to ready. The problem is that this update skips state_machine
transition callbacks. Write spec to show this behavior.

When `complete!` is called on order, it then updates all the shipments
to `ready`. The problem is that this update skips state_machine
transition callbacks. Write spec to show this behavior.
@skukx skukx force-pushed the BUG/shipment-transitions branch from ad62c26 to 4de3543 Compare July 6, 2017 16:47
@kennyadsl
Copy link
Member

Also, from Rails 4+ that update! method on Spree::Shipment is overriding the ActiveRecord update! method and I don't think it has been done intentionally.

P.S. We probably have the same problem on Spree::Order

@cbrunsdon
Copy link
Contributor

Hi @skukx, a few of us are in the middle of a conversation about this IRL and we're trying to get a better picture about how people are using the state machine on shipments (because as you can see it has a lot of issues).

Can you share what it is you're looking for on ready being called? Is there a "better" time you actually want it called, but are hooking into ready because it should be easy, or is shipment.ready for sure the exact time you want something to be executed?

@skukx
Copy link
Contributor Author

skukx commented Jul 12, 2017

@cbrunsdon right now we are working on integrating with our WMS. The idea was to send our wms what items to ship as the Solidus::Shipment moves to ready. This would ensure that payment is full, and that there is enough stock. Normally the WMS could probably account for the stock portion but the WMS we have a contract with doesn't have the most friendly API.

@jhawthorn
Copy link
Contributor

We understand the problem here and desire to have a better way to hook into state changes. We'd like to find a better way for stores to hook into events like orders completing, payments being received, and shipments being shipped.

Unfortunately the Shipment state machine isn't really a state machine. It's mostly a calculated state field. I'm not even sure the "ready" state should exist.

Closing because this isn't mergeable or immediately actionable.

@jhawthorn jhawthorn closed this Oct 4, 2017
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.

4 participants