Remove Line Item currency attribute#998
Closed
Conversation
This was referenced Mar 21, 2016
Closed
Somehow, in the past, it was possible to have orders with line items in multiple currencies. The code to remedy this (Order#homogenize_line_item_currencies) disappeared in #635, and now we have a bunch of code in different places that allows setting it, raises errors if it's not there, and so on. This commit delegates the line items currency to the order. Whenever people try *setting* a line item's currency, they get a pretty deprecation warning telling them not to do so. The error handling functionality that seems to be used in the order importer is still present (ie: If we know an imported line item has a currency different from the order, we'll error out). This commit replaces all that behaviour with a simple delegate that always obtains a line item's currency from it's order. Adds a changelog entry. I also refactored `OrderContents#add_to_line_item`, taking code from https://github.com/MountainRoseHerbs/spree/commit/461f97510c29d50c08c6d8b75805b66f12de12af That method should now be much easier to understand.
Member
|
I do think that this makes sense. However, I am concerned about potentially destroying data that people were relying upon if they had customized their store. I would appreciate some more opinions on this one. |
Contributor
Author
|
Closing in favour of #1007, which does not remove the column but makes handling line item currencies saner. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Somehow, in the past, it was possible to have orders with line items
in multiple currencies. The code to remedy this (Order#homogenize_line_item_currencies)
disappeared in #635, and now we have a bunch of code in different places
that allows setting it, raises errors if it's not there, and so on.
This commit delegates the line items currency to the order.
Whenever people try setting a line item's currency, they get a
pretty deprecation warning telling them not to do so.
The error handling functionality that seems to be used in the order
importer is still present (ie: If we know an imported line item has
a currency different from the order, we'll error out).
This commit replaces all that behaviour with a simple delegate that
always obtains a line item's currency from it's order.
Adds a changelog entry.
I also refactored
OrderContents#add_to_line_item, taking code fromMountainRoseHerbs/spree@461f975.
That method should now be much easier to understand.