summaryrefslogtreecommitdiff
path: root/addons/stock_picking_batch/wizard/stock_package_destination.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/stock_picking_batch/wizard/stock_package_destination.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/stock_picking_batch/wizard/stock_package_destination.py')
-rw-r--r--addons/stock_picking_batch/wizard/stock_package_destination.py25
1 files changed, 25 insertions, 0 deletions
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()