diff options
| author | Tiffany Chang (tic) <tic@odoo.com> | 2020-06-12 15:01:53 +0000 |
|---|---|---|
| committer | svs-odoo <svs@odoo.com> | 2020-08-20 15:06:08 +0000 |
| commit | 58316d1546420d72642a13d9648b323f4b1dfd59 (patch) | |
| tree | 197c6fc469a589950161c5e8de2ce5494b22c755 /addons/stock_picking_batch/wizard | |
| parent | d8cd37fc7261daaf2d71756ceb85c758d2460744 (diff) | |
[IMP] delivery, stock(_picking_batch): add "Put In Pack" button
This commit sets up the logic and adds the button for "Put in Pack"
action that already exists in stock.picking. Reuse/extension of logic
from stock.picking reused where possible, including extension of pack
wizard to handle products with different destination.
Note that logic to handle "Delivery Packaging" wizard when "Delivery
Methods" is active was purposely not extended to work correctly in batch
pickings due to complexity of adding in a new module just to handle
conflicting carrier_ids across pickings in the same batch. It is
expected that this use case will not occur except in case of user error.
Additionally, stock.picking implementation of 'put_in_pack' method has
been renamed to 'action_put_in_pack' to have consistent naming (and
support enterprise level code).
Part of "1. Improve Batch Pickings" specification of overall barcode
improvements task.
Task: 1884520
Enterprise PR: odoo/enterprise#12086
Closes: odoo/odoo#55096
Diffstat (limited to 'addons/stock_picking_batch/wizard')
| -rw-r--r-- | addons/stock_picking_batch/wizard/__init__.py | 1 | ||||
| -rw-r--r-- | addons/stock_picking_batch/wizard/stock_package_destination.py | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/addons/stock_picking_batch/wizard/__init__.py b/addons/stock_picking_batch/wizard/__init__.py index 063ece3795c..cfb88076d83 100644 --- a/addons/stock_picking_batch/wizard/__init__.py +++ b/addons/stock_picking_batch/wizard/__init__.py @@ -2,3 +2,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import stock_picking_to_batch +from . import stock_package_destination 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 00000000000..05b60cf0ad8 --- /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() |
