mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[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
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
from . import mrp_bom_line
|
||||
from . import mrp_production
|
||||
from . import stock_move
|
||||
|
||||
27
mrp_packaging_default/models/mrp_production.py
Normal file
27
mrp_packaging_default/models/mrp_production.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# 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
|
||||
@@ -22,7 +22,6 @@ class StockMove(models.Model):
|
||||
vals.update(
|
||||
{
|
||||
"product_packaging_id": bom_line.product_packaging_id.id,
|
||||
"product_packaging_qty": bom_line.product_packaging_qty,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user