This repository has been archived by the owner on Sep 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Set pre_tax_amount on line items and shipments when generating sales invoice #6
Merged
jordan-brough
merged 3 commits into
solidusio:master
from
richardnuno:order-pre-tax-amounts
Aug 10, 2015
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
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.
I'm a little freaked out by this. Invoice generation is causing line item amount and shipment to be updated. That's not the sort of behaviour that I would expect when generating and invoice.
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.
@gmacdougall it does a whole bunch more than this:
solidus_avatax/app/models/spree_avatax/sales_shared.rb
Lines 32 to 52 in 647b1bf
Are you saying we should have more comments on the
generate
method? Or that a more descriptive name would be nice? Or that you wish we had a better way to integrate w/ taxes in Solidus? Or something else?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.
@gmacdougall this was already happening later on, this is just to ensure that the values are still set in case the invoice cannot be generated for any reason (e.g. Avatax network timeout). Storing the pre_tax_amount is even overriden given we handle it at a different time as the comment mentions.
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.
I'm not sure where the responsibility should live, but I was taken aback by an invoice generator updating records on the thing it is generating an invoice for.
It might not be feasible to fix now, but I does seem a bit strange to me.
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.
That seems like a reasonable concern and, all things considered, I think that falls under the "bad name" category because I think the most pragmatic way to make that better would be to rename this method
calculate_and_set_taxes
(or something like that) and deprecate the namegenerate
.But in any case this PR isn't a significant change as far as how it mutates the order so how about we open an issue or a separate PR around that.
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.
Fair enough. I didn't have a lot of context around this, so it just seemed a bit odd to me on first glance.
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 @gmacdougall. @jordan-brough Could you take care of opening up the issue and merging this in please?
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.
@richardnuno sure, here's the issue: #7