Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP] purchase_order_line_qty_by_packaging: Correct packaging. #3144

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions purchase_order_line_qty_by_packaging/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import purchase_order_line
from . import stock_picking
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def _prepare_stock_move_vals(
res.update(
{
"product_packaging_id": self.product_packaging_id.id,
"product_packaging_qty": self.product_packaging_qty,
}
)
return res
21 changes: 21 additions & 0 deletions purchase_order_line_qty_by_packaging/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models


class StockPicking(models.Model):
_inherit = "stock.picking"

def button_force_done_detailed_operations(self):
result = super().button_force_done_detailed_operations()
for picking in self:
for line in picking.move_line_ids_without_package:
if (
line.move_id
and line.move_id.purchase_line_id
and line.move_id.purchase_line_id.product_packaging_id
):
line.product_packaging_qty = (
line.move_id.purchase_line_id.product_packaging_qty
)
return result
Loading