-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[16.0][IMP] sale_triple_discount: Compute amount with decimal precision of 16 #2649
base: 16.0
Are you sure you want to change the base?
Conversation
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.
Could you add a test case for this ?
6eaf365
to
ab1059b
Compare
Added the exact use case I had issues with, if you multiply |
@@ -97,6 +97,9 @@ def triple_discount_preprocess(self): | |||
this method is called multiple times.""" | |||
|
|||
prev_values = dict() | |||
digits = self._fields["discount"]._digits | |||
self.env["sale.order.line"]._fields["discount"]._digits = (16, 16) |
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 fan of this. I think this could lead to unwanted side effects.
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.
Its not very pretty but I think it hasn't caused any issues for us so far, its mainly copying the process in the account equivalent module https://github.com/OCA/account-invoicing/blob/d2e12c03b50011bb788cf482346710f0fefe0de3/account_invoice_triple_discount/models/account_move_line.py#L73-L74 so it calculates the same discount, otherwise it can lead to different rounding
78a1fbe
to
c178a00
Compare
c178a00
to
a0a1daf
Compare
a0a1daf
to
be6dcba
Compare
https://github.com/OCA/account-invoicing/blob/d2e12c03b50011bb788cf482346710f0fefe0de3/account_invoice_triple_discount/models/account_move_line.py#L73-L74