odoo/enterprise#77438

Created by fw-bot
Merged at 05839cda6739f3ba3df82df6974f1e7447fc0ec8

Statuses:

label
odoo-dev:saas-17.2-17.0-OPW-4183097-scraps_missing_in_cost_analysis-kdeb-OZ89-fw
head
239c75a1fefa5b217849056bba4cc78ce4bbb904
merged
9 months ago by Bugfix, Kawtar Drissi El Bouzaidi (kdeb)
odoo/odoo odoo/enterprise
17.0 #188639 #75221
saas-17.2 #77438
saas-17.4 #77444
18.0 #77449
saas-18.1 #77451
saas-18.2
saas-18.3
saas-18.4
19.0
master #77539

[FW][FIX] mrp_account_enterprise: use correct scrap qty field in Cost Analysis

Issue:
In 17.0 and saas-17.2, The Cost of Scrap section does not appear
in the the Cost Analysis Report despite having scrapped some components
during manufacturing.

Steps to reproduce:
1. Create a product with a BoM
2. Manufacture the product
3. Scrap some components during manufacturing
4. print the Cost Analysis Report
5. Notice the cost of scrap section does not appear in the report.

Solution:
- I added raw_material_production_id to the search criteria to ensure scrap stock moves linked to raw materials are also included.
- I replaced product_qty with the quantity field for handling scrap quantities.
opw-4183097

Forward-Port-Of: #75221