odoo/enterprise#75221

Created by Bugfix, Kawtar Drissi El Bouzaidi (kdeb)
Merged at 4b312d56e7fa01ab4e8f534a1e62ef59e1421f77

Statuses:

label
odoo-dev:17.0-OPW-4183097-scraps_missing_in_cost_analysis-kdeb
head
60d3a0c90ae07a906d7f93e042619004fc5b20ce
merged
9 months ago by Logistics, Tiffany Chang (tic)
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

[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