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

Account Invoice Triple Discount does not compute correctly price_subtotal #1240

Open
1 task done
c-amara opened this issue Sep 17, 2022 · 4 comments
Open
1 task done
Labels
bug stale PR/Issue without recent activity, it'll be soon closed automatically.

Comments

@c-amara
Copy link

c-amara commented Sep 17, 2022

The module does not compute correctly the price_subtotal field because the price rounding feature.

Module

account_invoice_triple_discount

Describe the bug

When the invoice has a price and a discount (just one discount can reproduce the issue) that produce a discounted price with more decimals than price rounding setting so the price_subtotal is wrong.

To Reproduce

An example is:
qty price discount discount2 discount3 subtotal
9950 0.139 15% 0 0 1176.09

but the right subtotal is 1175.59 because 0.139 minus 15% is 0.11815 * 9950 = 1175.5925 -> Rounded = 1175.59.

Affected versions:

  • 12.0
@c-amara c-amara added the bug label Sep 17, 2022
@legalsylvain
Copy link
Contributor

Could you add in a PR a test that is failing ?
Thanks !

@c-amara
Copy link
Author

c-amara commented Sep 24, 2022

Just added
#1242

@ramiadavid
Copy link
Contributor

@legalsylvain @c-amara

I have the same problem, even using only Odoo's default discount field and the problem is here

        for line in self.line_ids:
            aggregated_discount = line._compute_aggregated_discount(line.discount)
            old_values_by_line_id[line.id] = {
                "price_unit": line.price_unit,
                "discount": line.discount,
            }
            price_unit = line.price_unit * (1 - aggregated_discount / 100)
            line.update({"price_unit": price_unit, "discount": 0})**

To calculate the taxes here the unit price with the aggregated discounts is computed, but when saving the value in the line Odoo rounds to the decimals by default and this produces an inaccuracy when calculating the taxes and the base especially when the line contains many units.

Copy link

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

No branches or pull requests

3 participants