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

Do not use computed value for new computation #309

Merged
merged 2 commits into from
Jul 4, 2016

Conversation

mdietrichc2c
Copy link
Contributor

@mdietrichc2c mdietrichc2c commented Jun 9, 2016

This PR is to fix a small "edge case" I had with a customer : basically, the line's old value was used to recompute the value itself.
In that particular case, the taxes and total amount made it so that the small amount variation was over/under 3.815, which meant that:

  • if the line had a value of 3.81, the computed value was 3.82,
  • then, when the line had a value of 3.81, the computed value was 3.81.

That means, in the method https://github.com/OCA/sale-workflow/blob/8.0/sale_payment_term_interest/model/sale_order.py#L99 , the 2 values were always different by 0.01.

The fix is straight-forward : instead of substracting the interest line's amount to the total amount, all non-interest lines are added (meaning the value used as a basis remains constant).

line = self._get_interest_line()
if line:
for line in [line for line in self.order_line
if not line.interest_line]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep the modularity you could change the condition to if not line == self._get_interest_line()

@coveralls
Copy link

coveralls commented Jun 9, 2016

Coverage Status

Coverage decreased (-0.009%) to 75.434% when pulling 0eab6ba on mdietrichc2c:8.0-fix-payment-term-interest into fd6ab01 on OCA:8.0.

@mdietrichc2c
Copy link
Contributor Author

@guewen corrected, thanks for the review

@coveralls
Copy link

coveralls commented Jun 9, 2016

Coverage Status

Coverage decreased (-0.009%) to 75.434% when pulling 4842cd4 on mdietrichc2c:8.0-fix-payment-term-interest into fd6ab01 on OCA:8.0.

@guewen
Copy link
Member

guewen commented Jun 9, 2016

Thanks 👍

@atchuthan
Copy link
Member

👍

@guewen guewen merged commit 8497281 into OCA:8.0 Jul 4, 2016
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

Successfully merging this pull request may close these issues.

None yet

4 participants