Skip to content
Snippets Groups Projects
Commit c2750517 authored by Adrien Widart's avatar Adrien Widart
Browse files

[FIX] stock_landed_costs: round using the currency rounding

In some cases, it is impossible to validate some landed costs ("Cost and
adjustments lines do not match.[...]")

To reproduce the issue:
(Enable debug mode)
1. Set the Decimal Accuracy of Product Price to 4
2. Create a Product Category PC:
    - Costing Method: FIFO
3. Create 4 storable products (category PC)
4. Create a service product (landed cost)
5. Create a PO with the 4 products:
    - 6 x $0.92
    - 6 x $0.92
    - 3 x $75.17
    - 6 x $20.54
6. Process the delivery D
7. Create a Landed Cost:
    - Delivery: D
    - Product: the service product
        - Split Method: By Quantity
        - Cost: $1000
8. Compute the landed costs + Validate

Error: a User Error is raised "Cost and adjustments lines do not match.
You should maybe recompute the landed costs.". The sum of the additional
landed cost equals $999.99 instead of $1000

From version 14, `additional_landed_cost` is a Monetary field and its
rounding property is no more based on "Product Price":
https://github.com/odoo/odoo/blob/800433bde03a36ead40a78bc6d53cbb95c24f97b/addons/stock_landed_costs/models/stock_landed_cost.py#L371-L372


Therefore, we should use the rounding of the associated currency to
round its value

OPW-2637701
OPW-2631718
OPW-2649348

closes odoo/odoo#77155

Signed-off-by: default avatarWilliam Henrotin <Whenrow@users.noreply.github.com>
parent 606dbc79
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment