odoo/odoo#196227

Created by David Van Droogenbroeck (drod)
Merged at 0eed6a8779360dd80cb3610c7c001ef31667c661

Statuses:

label
odoo-dev:17.0-opw-4473337-MO_qty_upon_bom_update-drod
head
cbb753d6d0e9c0dfd658f99f32097123b4a2a622
merged
6 months ago by Logistics, Tiffany Chang (tic)
odoo/odoo
17.0 #196227
saas-17.4 #203010
18.0 #203017
saas-18.1 #203021
saas-18.2 #203026
saas-18.3
saas-18.4
19.0
master #203029

[FIX] mrp: correctly update MO consumption on kit BoM update

This PR addresses 2 issues with the update of Manufacturing Order with kit products in the BoM (and subsequent bugs). Please see commits for details on the issues.

Issue 1

When using the "Update BOM" button for a confirmed manufacturing order, quantities for components derived from kit products are incorrectly updated to the kit product's bom instead of the new required quantity.

Issue 2

When using the "Update BOM" button for a confirmed manufacturing order, components used to produce a specific variant of a kit product are not added to the MO consumables.

Commit breakdown

  • Commit 1 (handle component quantities - first ticket):
  • use the correct exploded value for the quantity (divided by the original quantity as the ratio isn't done for the top-level bom)
  • update test_update_mo_from_bom_with_kit with correct values
  • extend test_update_mo_from_bom_with_kit for when the kit components' quantities are updated
  • Commit 2 (handle components for specific variants - second ticket):
  • adapt the filtering of bom lines to keep them based on the kit's attribute instead of the end product one's
  • add a new test_update_mo_from_bom_with_kit_vraiants
  • Commit 3 (handle confusion of multi-variants/UoM kits - additional issues):
  • change bom_lines_by_id to a defaultdict to consolidate quantity of components
  • update test_update_mo_from_bom_with_kit to test for multiple UoMs
  • update test_update_mo_from_bom_with_kit_variants to test for multiple variants

Tickets:
opw-4473337
opw-4480039