From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- .../wizard/stock_package_destination.py | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 addons/stock_picking_batch/wizard/stock_package_destination.py (limited to 'addons/stock_picking_batch/wizard/stock_package_destination.py') diff --git a/addons/stock_picking_batch/wizard/stock_package_destination.py b/addons/stock_picking_batch/wizard/stock_package_destination.py new file mode 100644 index 00000000..05b60cf0 --- /dev/null +++ b/addons/stock_picking_batch/wizard/stock_package_destination.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import api, models + + +class ChooseDestinationLocation(models.TransientModel): + _inherit = "stock.package.destination" + + def _compute_move_line_ids(self): + destination_without_batch = self.env['stock.package.destination'] + for destination in self: + if not destination.picking_id.batch_id: + destination_without_batch |= destination + continue + destination.move_line_ids = destination.picking_id.batch_id.move_line_ids.filtered(lambda l: l.qty_done > 0 and not l.result_package_id) + super(ChooseDestinationLocation, destination_without_batch)._compute_move_line_ids() + + def action_done(self): + if self.picking_id.batch_id: + # set the same location on each move line and pass again in action_put_in_pack + self.move_line_ids.location_dest_id = self.location_dest_id + return self.picking_id.batch_id.action_put_in_pack() + else: + return super().action_done() -- cgit v1.2.3