[MERGE] stock_picking_wave

bzr revid: qdp-launchpad@openerp.com-20130730162026-z5eotpik812252du
This commit is contained in:
Quentin (OpenERP) 2013-07-30 18:20:26 +02:00
commit 83fc208f3c
5 changed files with 209 additions and 0 deletions

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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/>.
#
##############################################################################
import stock_picking_wave
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 Picking Waves',
'version': '1.0',
'category': 'Stock Management',
'description': """
This module adds the picking wave option in warehouse management.
=================================================================
""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['stock'],
'data': ['security/ir.model.access.csv',
'stock_picking_wave_view.xml'],
'demo': [],
'installable': True,
'auto_install': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
stock_picking_wave,stock.picking.wave,model_stock_picking_wave,stock.group_stock_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 stock_picking_wave stock.picking.wave model_stock_picking_wave stock.group_stock_user 1 1 1 1

View File

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
from openerp.osv import fields, osv
class stock_picking_wave(osv.osv):
_name = "stock.picking.wave"
_columns = {
'name': fields.char('name', required=True, help='Name of the picking wave'),
'partner_id': fields.many2one('res.partner', 'Responsible', help='Person responsible for this wave'),
'time': fields.float('Time', help='Time it will take to perform the wave'),
'picking_ids': fields.one2many('stock.picking', 'wave_id', 'Pickings', help='List of picking associated to this wave'),
'capacity': fields.float('Capacity', help='The capacity of the transport used to get the goods'),
'capacity_uom': fields.many2one('product.uom', 'Unit of Measure', help='The Unity Of Measure of the transport capacity'),
}
def confirm_picking(self, cr, uid, ids, context=None):
picking_todo = self.pool.get('stock.picking').search(cr, uid, [('wave_id', 'in', ids)], context=context)
return self.pool.get('stock.picking').action_done(cr, uid, picking_todo, context=context)
def cancel_picking(self, cr, uid, ids, context=None):
picking_todo = self.pool.get('stock.picking').search(cr, uid, [('wave_id', 'in', ids)], context=context)
return self.pool.get('stock.picking').action_cancel(cr, uid, picking_todo, context=context)
def print_picking(self, cr, uid, ids, context=None):
'''
This function print the report for all picking_ids associated to the picking wave
'''
picking_ids = []
for wave in self.browse(cr, uid, ids, context=context):
picking_ids.append([picking.id for picking in wave.picking_ids])
datas = {
'ids': picking_ids,
'model': 'stock.picking',
'form': self.read(cr, uid, picking_ids, context=context)
}
return {
'type': 'ir.actions.report.xml',
'report_name': context.get('report', 'stock.picking.list'),
'datas': datas,
'nodestroy': True
}
class stock_picking(osv.osv):
_inherit = "stock.picking"
_columns = {
'wave_id': fields.many2one('stock.picking.wave', 'Picking Wave', help='Picking wave associated to this picking'),
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,96 @@
<openerp>
<data>
<record id="view_picking_wave_form" model="ir.ui.view">
<field name="name">picking.wave.form</field>
<field name="model">stock.picking.wave</field>
<field name="arch" type="xml">
<form string="Stock Picking Waves" version="7.0">
<sheet>
<div class="oe_right oe_button_box">
<button name="confirm_picking" string="Confirm all pickings" type="object"/>
<button name="cancel_picking" string="Cancel all pickings" type="object"/>
<button name="print_picking" string="Print all internal pickings" type="object" context="{'report':'stock.picking.list.internal'}"/>
<button name="print_picking" string="Print all in/out pickings" type="object" context="{'report':'stock.picking.list'}"/>
</div>
<group>
<group>
<field name="name"/>
<field name="partner_id"/>
</group>
<group>
<label for="capacity"/>
<div>
<field name="capacity" class="oe_inline"/>
<field name="capacity_uom" class="oe_inline"/>
</div>
<field name="time" widget="float_time"/>
</group>
</group>
<separator string="Pickings"/>
<field name="picking_ids" widget="many2many">
<tree>
<field name="name"/>
<field name="backorder_id"/>
<field name="origin"/>
<field name="date"/>
<field name="min_date"/>
<field name="invoice_state"/>
<field name="state"/>
<button name="action_done" string="Confirm picking" type="object" icon="gtk-apply" attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}"/>
<button name="action_cancel" string="Cancel picking" type="object" icon="gtk-cancel" attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}"/>
</tree>
</field>
</sheet>
</form>
</field>
</record>
<record id="view_picking_wave_tree" model="ir.ui.view">
<field name="name">picking.wave.tree</field>
<field name="model">stock.picking.wave</field>
<field name="arch" type="xml">
<tree string="Stock Picking Waves">
<field name="name"/>
<field name="partner_id"/>
<field name="capacity"/>
<field name="capacity_uom"/>
<field name="time" widget="float_time"/>
</tree>
</field>
</record>
<record id="action_picking_wave" model="ir.actions.act_window">
<field name="name">Picking Waves</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.picking.wave</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a Picking Wave.
</p><p>
The Goal of the picking waves is to group operations that may
(needs to) be done together in order to increase their efficiency.
It may also be useful to assign jobs (one person = one wave) or
help the timing management of operations (tasks to be done at 1pm).
</p>
</field>
</record>
<menuitem action="action_picking_wave" id="menu_action_picking_wave" parent="stock.menu_stock_warehouse_mgmt" sequence="30"/>
<record model="ir.ui.view" id="view_stock_picking_wave_inherit">
<field name="name">stock.picking.wave.inherit.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='picking_type_id']" position="after">
<field name="wave_id"/>
</xpath>
</field>
</record>
</data>
</openerp>