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

Absent Spree::OrderStockLocation class/file in v2.5.0 #2661

Closed
jcsanti opened this issue Mar 29, 2018 · 2 comments
Closed

Absent Spree::OrderStockLocation class/file in v2.5.0 #2661

jcsanti opened this issue Mar 29, 2018 · 2 comments

Comments

@jcsanti
Copy link
Contributor

jcsanti commented Mar 29, 2018

Hi,

We are using Solidus in production in the company I work at (epicery.com).

Following the release of v2.5.0 we created a branch to run our tests and see how things go. The removal — whether intentional or not — of order_stock_location.rb broke a lot of them.

Steps to reproduce

In our code base, simply doing this in a rails console:

Spree::Order.includes(:order_stock_location)

Expected behavior

This should not trigger any issue.

Actual behavior

NameError:
    uninitialized constant Spree::Order::Spree::OrderStockLocation

System configuration

Solidus Version: v2.5.0

Extensions in use:
solidus_core
solidus_backend
solidus_frontend
solidus_auth_devise
solidus_comments
solidus_product_assembly

Solidus diff

# git diff v2.4.2 v2.5.0 -- core/app/models/spree/order_stock_location.rb

diff --git a/core/app/models/spree/order_stock_location.rb b/core/app/models/spree/order_stock_location.rb
deleted file mode 100644
index ff734a50b..000000000
--- a/core/app/models/spree/order_stock_location.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-module Spree
-  class OrderStockLocation < Spree::Base
-    belongs_to :variant, class_name: "Spree::Variant"
-    belongs_to :stock_location, class_name: "Spree::StockLocation"
-    belongs_to :order, class_name: "Spree::Order"
-
-    def self.fulfill_for_order_with_stock_location(order, stock_location)
-      where(order_id: order.id, stock_location_id: stock_location.id).each(&:fulfill_shipment!)
-    end
-
-    def fulfill_shipment!
-      update_attributes!(shipment_fulfilled: true)
-    end
-  end
-end
# git show v2.5.0:core/app/models/spree/order.rb
# ...

has_many :order_stock_locations, class_name: "Spree::OrderStockLocation"
has_many :stock_locations, through: :order_stock_locations
@jcsanti jcsanti changed the title Absent Spree::OrderStockLocation class/file Absent Spree::OrderStockLocation class/file in v2.5.0 Mar 29, 2018
@stem
Copy link
Contributor

stem commented Apr 3, 2018

Hi,

In order to not loose what Kevin said on slack a few days ago, I paste it here :

@jhawthorn
Copy link
Contributor

This was actually extracted to https://github.com/solidusio-contrib/solidus_legacy_stock_system (solidus_stock_transfers was a separate effort)

The OrderStockLocation model became non-functional in Solidus 2.4 when the old Stock::Coordinator was extracted to solidus_legacy_stock_system. It would have been nice to have removed OrderStockLocation at that time, but I didn't get around to it until #2270

Including the solidus_legacy_stock_system should fix any issues. Though if you don't need location configured packages it is probably better to just remove references to them

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

No branches or pull requests

3 participants