-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Allow Importer::Order to accept array of line items and stock_location_id #3655
Conversation
shipment.stock_location = Spree::StockLocation.find_by(admin_name: target[:stock_location]) || Spree::StockLocation.find_by!(name: target[:stock_location]) | ||
shipment.stock_location = Spree::StockLocation.find_by(id: target[:stock_location_id]) || | ||
Spree::StockLocation.find_by(admin_name: target[:stock_location]) || | ||
Spree::StockLocation.find_by!(name: target[:stock_location]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/MultilineOperationIndentation: Align the operands of an expression in an assignment spanning multiple lines.
@@ -56,7 +56,9 @@ def self.create_shipments_from_params(shipments_hash, order) | |||
shipments_hash.each do |target| | |||
shipment = Shipment.new | |||
shipment.tracking = target[:tracking] | |||
shipment.stock_location = Spree::StockLocation.find_by(admin_name: target[:stock_location]) || Spree::StockLocation.find_by!(name: target[:stock_location]) | |||
shipment.stock_location = Spree::StockLocation.find_by(id: target[:stock_location_id]) || | |||
Spree::StockLocation.find_by(admin_name: target[:stock_location]) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/MultilineOperationIndentation: Align the operands of an expression in an assignment spanning multiple lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ccarruitero, it works for me.
I'd also deprecate the line_items_hash
since it's no more always a hash, maybe line_items
with some good YARD documentation of this method args is enough to make it more clear. But we can do this in another PR if we have time.
Description
This PR is for improve
Importer::Order
to allowstock_location_id
when create shipments and allow use an array forline_item_attributes
.Importer::Order
is used internally forsolidus_api
to create orders, and like is documented should allowstock_location_id
inshipments_attributes
and an array forline_item_attributes
.Checklist: