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

total_amount is not calculated when a line item is added #61

Open
etcook opened this issue Oct 1, 2018 · 2 comments
Open

total_amount is not calculated when a line item is added #61

etcook opened this issue Oct 1, 2018 · 2 comments

Comments

@etcook
Copy link

etcook commented Oct 1, 2018

Because the calculate_total_amount callback is only run on before_validation, the amount never gets updated unless you update the invoice. Even touching it or using something like AASM to change state won't trigger the callback to be run.

This should probably be changed to a more liberal callback or at least supported with a callback on line_item that gets triggered on save.

@etcook
Copy link
Author

etcook commented Oct 9, 2020

@iffyuva This is one I'd like to address, however, any implementation will be opinionated so I'd like to get feedback first. Are we trying to avoid invoice total calculation with each line_item save for performance reasons?

@iffyuva
Copy link
Member

iffyuva commented Oct 9, 2020

@etcook I don't remember the reason for not incorporating this. Only think I can think of is: Supporting older rails versions.

I'm happy to add this behavior. Please open a PR whenever you are free. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants