Sunday, August 25, 2024
1 change
Resolved issues and error corrections
This fix corrects an error in the Production Analysis report where subcontracting costs per unit were being calculated incorrectly (showing $40 instead of $20). The issue occurred because manufacturing moves were being duplicated in the report calculation, causing costs to be inflated. This ensures accurate cost reporting for subcontracted manufacturing operations.
Original PR description
Steps to reproduce the bug: - Create a storable product P1 with the following BoM: - Type: Subcontracting - Subcontractor: Azure Interior - Components: - C1: 1 unit (price of C1: $10) - Cost of P1:…
Steps to reproduce the bug:
- Create a storable product P1 with the following BoM:
- Type: Subcontracting
- Subcontractor: Azure Interior
- Components:
- C1: 1 unit (price of C1: $10)
- Cost of P1: $10
- Create a purchase order:
- Product: P1
- Quantity: 100 units
- Confirm the purchase order.
- Receive 99 units and create a backorder for 1 unit.
- Go to Manufacturing > Reporting > Production Analysis.
Problem:
The "Total Subcontracting Cost / Unit" is $40 instead of $20. This
occurs because, in the SQL query, when performing the left join
between `stock_move_move_rel` and `stock_move`, the moves appear
duplicated as they have the same `move_orig_id`. Consequently, when
calculating the total quantity, it results in
`(99 + 99) = 198 * $20 = $3960`, but the total is only divided by the
quantity of one move, leading to $3960 / 99 = $40.
opw-[4061947](https://www.odoo.com/web#id=4061947&view_type=form&model=project.task)
Forward-Port-Of: odoo/enterprise#68778