-
- Downloads
[FIX] sale: round untaxed amount to invoice after computations
Suppose such a SO line: - Unit Price: 541.26 - Qty: 38 - Discount: 2% The line amount is computed thanks to application of the discount on the price, then the multiplication of the result with the quantity. The rounding eventually happens after these steps: https://github.com/odoo/odoo/blob/254b2a0840d3e817cc6062c483b5213c10088af5/addons/sale/models/sale.py#L1013-L1024 https://github.com/odoo/odoo/blob/b76e9ef658bde0178fa1660b6ad27b880e91632a/addons/account/models/account.py#L1138 Therefore, in the above case, we have: ``` Total = round(541.26 * 0.98 * 38) = round(530.4348 * 38) = round(20156.5224) = 20156.5224 ``` However, when confirming the SO and setting the delivered quantity, the Untaxed Amount To Invoice is computed using the unit price with both the discount and the rounding already applied: ``` Total = round(541.26 * 0.98) * 38 = round(530.4348) * 38 = 530.43 * 38 = 20156.34 ``` As a result, the amount is not the same than the first one, this is incorrect. OPW-2525975 closes odoo/odoo#74625 X-original-commit: 1622ee96 Signed-off-by:Adrien Widart <adwid@users.noreply.github.com>
Loading
Please register or sign in to comment