diff --git a/stock_transfer_continue_later/__init__.py b/stock_transfer_continue_later/__init__.py new file mode 100644 index 0000000..3b4c3ed --- /dev/null +++ b/stock_transfer_continue_later/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import wizard diff --git a/stock_transfer_continue_later/__openerp__.py b/stock_transfer_continue_later/__openerp__.py new file mode 100644 index 0000000..c06e556 --- /dev/null +++ b/stock_transfer_continue_later/__openerp__.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Stock Transfer Continue Later module for Odoo +# Copyright (C) 2015 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'Stock Transfer Continue Later', + 'version': '0.2', + 'category': 'Inventory, Logistic, Storage', + 'license': 'AGPL-3', + 'summary': "Add button 'Save and continue later' on picking Transfer wizard", + 'description': """ +Stock Transfer Continue Later +============================= + +This module adds a button *Save and Continue Later* on the Transfer pop-up of the picking. This is usefull for example if you have a big reception and you cannot handle it in one go but you work on it in several steps before you validate the full transfer. + +This module has been written by Alexis de Lattre from Akretion . + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['stock'], + 'data': ['wizard/stock_transfer_details.xml'], + 'installable': True, +} diff --git a/stock_transfer_continue_later/wizard/__init__.py b/stock_transfer_continue_later/wizard/__init__.py new file mode 100644 index 0000000..82e13e1 --- /dev/null +++ b/stock_transfer_continue_later/wizard/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import stock_transfer_details diff --git a/stock_transfer_continue_later/wizard/stock_transfer_details.py b/stock_transfer_continue_later/wizard/stock_transfer_details.py new file mode 100644 index 0000000..0a83f88 --- /dev/null +++ b/stock_transfer_continue_later/wizard/stock_transfer_details.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Stock Transfer Continue Later module for Odoo +# Copyright (C) 2015 Akretion (http://www.akretion.com) +# Copyright (C) 2015 Odoo S.A. +# @author Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +from openerp import models, api +from datetime import datetime + + +class StockTransferDetails(models.TransientModel): + _inherit = 'stock.transfer_details' + + @api.multi + def continue_later(self): + # This is a copy-paste of the method do_detailed_transfer() + # from odoo/addons/stock/wizard/stock_transfer_details.py + # without the last line "self.picking_id.do_transfer()" + processed_ids = [] + # Create new and update existing pack operations + for lstits in [self.item_ids, self.packop_ids]: + for prod in lstits: + pack_datas = { + 'product_id': prod.product_id.id, + 'product_uom_id': prod.product_uom_id.id, + 'product_qty': prod.quantity, + 'package_id': prod.package_id.id, + 'lot_id': prod.lot_id.id, + 'location_id': prod.sourceloc_id.id, + 'location_dest_id': prod.destinationloc_id.id, + 'result_package_id': prod.result_package_id.id, + 'date': prod.date if prod.date else datetime.now(), + 'owner_id': prod.owner_id.id, + } + if prod.packop_id: + prod.packop_id.with_context(no_recompute=True).write(pack_datas) + processed_ids.append(prod.packop_id.id) + else: + pack_datas['picking_id'] = self.picking_id.id + packop_id = self.env['stock.pack.operation'].create(pack_datas) + processed_ids.append(packop_id.id) + # Delete the others + packops = self.env['stock.pack.operation'].search(['&', ('picking_id', '=', self.picking_id.id), '!', ('id', 'in', processed_ids)]) + packops.unlink() + return True diff --git a/stock_transfer_continue_later/wizard/stock_transfer_details.xml b/stock_transfer_continue_later/wizard/stock_transfer_details.xml new file mode 100644 index 0000000..2dbd20c --- /dev/null +++ b/stock_transfer_continue_later/wizard/stock_transfer_details.xml @@ -0,0 +1,26 @@ + + + + + + + + + + stock_transfer_continue_later.stock_transfer_details + stock.transfer_details + + + + + + + + diff --git a/stock_usability/stock_view.xml b/stock_usability/stock_view.xml index e3c3112..b7fc0ff 100644 --- a/stock_usability/stock_view.xml +++ b/stock_usability/stock_view.xml @@ -21,6 +21,12 @@ +