Files
manufacture/mrp_packaging_default/models/mrp_production.py
Jairo Llopis 970a80b56f [FIX] mrp_packaging_default: multiply packagings per products manufactured
Before this patch, the amount of packagings was the same in an `mrp.production`, no matter the ordered quantity.

This was a conceptual mistake. Packaging qtys had to be multiplied, just like it happens with UoM qtys.

@moduon MT-8145
2024-11-22 13:35:48 +00:00

28 lines
777 B
Python

# Copyright 2024 Moduon Team S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)
from odoo import models
class MrpProduction(models.Model):
_inherit = "mrp.production"
def _get_move_raw_values(
self,
product_id,
product_uom_qty,
product_uom,
operation_id=False,
bom_line=False,
):
"""Include packaging in new move values."""
result = super()._get_move_raw_values(
product_id,
product_uom_qty,
product_uom,
operation_id=operation_id,
bom_line=bom_line,
)
if bom_line and bom_line.product_packaging_id:
result["product_packaging_id"] = bom_line.product_packaging_id.id
return result