Add module stock_transfer_continue_later
This commit is contained in:
3
stock_transfer_continue_later/__init__.py
Normal file
3
stock_transfer_continue_later/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import wizard
|
||||||
43
stock_transfer_continue_later/__openerp__.py
Normal file
43
stock_transfer_continue_later/__openerp__.py
Normal file
@@ -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 <alexis.delattre@akretion.com>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
'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 <alexis.delattre@akretion.com>.
|
||||||
|
""",
|
||||||
|
'author': 'Akretion',
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': ['stock'],
|
||||||
|
'data': ['wizard/stock_transfer_details.xml'],
|
||||||
|
'installable': True,
|
||||||
|
}
|
||||||
3
stock_transfer_continue_later/wizard/__init__.py
Normal file
3
stock_transfer_continue_later/wizard/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import stock_transfer_details
|
||||||
@@ -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 <alexis.delattre@akretion.com>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2015 Akretion (http://www.akretion.com/)
|
||||||
|
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
The licence is in the file __openerp__.py
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="view_stock_enter_transfer_details" model="ir.ui.view">
|
||||||
|
<field name="name">stock_transfer_continue_later.stock_transfer_details</field>
|
||||||
|
<field name="model">stock.transfer_details</field>
|
||||||
|
<field name="inherit_id" ref="stock.view_stock_enter_transfer_details" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<button name="do_detailed_transfer" position="after">
|
||||||
|
<button name="continue_later" string="Save and Continue Later"
|
||||||
|
type="object"/>
|
||||||
|
</button>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
@@ -21,6 +21,12 @@
|
|||||||
<field name="date_done" position="attributes">
|
<field name="date_done" position="attributes">
|
||||||
<attribute name="groups"></attribute>
|
<attribute name="groups"></attribute>
|
||||||
</field>
|
</field>
|
||||||
|
<!-- Maybe it's usefull to always display stock pack operations...
|
||||||
|
or maybe only for debugging... I haven't decided yet !
|
||||||
|
<page string="Operations" position="attributes">
|
||||||
|
<attribute name="attrs"></attribute>
|
||||||
|
</page>
|
||||||
|
-->
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user