diff options
| author | amoyaux <arm@odoo.com> | 2017-08-28 09:32:34 +0200 |
|---|---|---|
| committer | amoyaux <arm@odoo.com> | 2017-09-26 09:31:26 +0200 |
| commit | 589a38ce338d4e56f0b5a8d026183316f7896592 (patch) | |
| tree | 6576744a8d65b8c06d7e28dfb6195f57e558157b /addons/stock_picking_batch/wizard | |
| parent | 03559629ee3f8ef28e51d8ed659fc7c09b176955 (diff) | |
[IMP] stock_picking_batch: ask for qty done and backorder
Previsously picking batch done button automatically run backorder
for picking that need and set a quantity done for picking without it
This commit changes the function done for picking wave in order to
call the needed wizard(set qty_done automatically or asking for a
backorder). Also it override the immediate transfer wizard in order to
pass the picking to backorder found in done function through the process
action.
pick_to_backorder_ids is needed in immediate transfer since we need to
pass the backorders from the done function in stock_picking_batch
through the immediate transfer wizard.
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_immediate_transfer.py | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/addons/stock_picking_batch/wizard/__init__.py b/addons/stock_picking_batch/wizard/__init__.py index 063ece3795c..92e3d6e014e 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_immediate_transfer diff --git a/addons/stock_picking_batch/wizard/stock_immediate_transfer.py b/addons/stock_picking_batch/wizard/stock_immediate_transfer.py new file mode 100644 index 00000000000..57de52d59af --- /dev/null +++ b/addons/stock_picking_batch/wizard/stock_immediate_transfer.py @@ -0,0 +1,20 @@ +from odoo import models, fields, api + + +class StockImmediateTransfer(models.TransientModel): + _inherit = 'stock.immediate.transfer' + _description = 'Immediate Transfer' + + pick_to_backorder_ids = fields.Many2many('stock.picking', help='Picking to backorder') + + @api.multi + def process(self): + backorder_wizard_dict = super(StockImmediateTransfer, self).process() + # If the immediate transfer wizard process all our picking but with some back order maybe needed we want to add the backorder already passed to the wizard. + if backorder_wizard_dict is not None: + backorder_wizard = self.env['stock.backorder.confirmation'].browse(backorder_wizard_dict.get('res_id', False)) + backorder_wizard.write({'pick_ids': [(4, p.id) for p in self.pick_to_backorder_ids]}) + return backorder_wizard_dict + # If there is no backorder returned by the immediate transfer basic function we still wanted to process those manually given + elif self.pick_to_backorder_ids: + return self.pick_to_backorder_ids.action_generate_backorder_wizard() |
