-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[FIX] sale_discount_display_amount: reset discount_subtotal when discount is removed #3927
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
base: 18.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,6 @@ def _update_discount_display_fields(self): | |
| if not line.discount: | ||
| line.price_subtotal_no_discount = line.price_subtotal | ||
| line.price_total_no_discount = line.price_total | ||
| continue | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The root cause is that Preferred fix: keep line.discount_total = 0
line.discount_subtotal = 0 # add this lineThis directly addresses the missing reset and preserves the early-exit optimization.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review @alexey-pelykh. I’ll check the suggested changes and update the code accordingly: Restore the continue Add line.discount_subtotal = 0 to the initialization block Add the missing regression test for the apply-then-remove scenario I’ll push the updated changes shortly. |
||
| price = line.price_unit | ||
| taxes = line.tax_id.compute_all( | ||
| price, | ||
|
|
||
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.
@Jay2163 Thanks for this. Could you add a test for that case ?
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.
Sure, I’ll add a test for this case and update the PR.