[MERGE] Picking Wave improvements

bzr revid: fp@openerp.com-20130802173108-1frn0pa3wv40ao3z
This commit is contained in:
Fabien Pinckaers
2013-08-02 19:31:08 +02:00
7 changed files with 107 additions and 2 deletions
+1
View File
@@ -20,5 +20,6 @@
##############################################################################
import stock_picking_wave
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+2 -1
View File
@@ -32,7 +32,8 @@ This module adds the picking wave option in warehouse management.
'depends': ['stock'],
'data': ['security/ir.model.access.csv',
'stock_picking_wave_view.xml',
'stock_picking_wave_sequence.xml'],
'stock_picking_wave_sequence.xml',
'wizard/picking_to_wave_view.xml'],
'demo': [],
'installable': True,
'auto_install': True,
@@ -12,7 +12,9 @@ class stock_picking_wave(osv.osv):
'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'),
'wave_type': fields.many2one('stock.picking.wave.type', 'Picking Wave Type'),
'state': fields.selection([('in_progress', 'Running'), ('done', 'Done'), ('cancel', 'Cancelled')], required=True),
}
_defaults = {
'name': '/',
@@ -71,5 +73,18 @@ 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'),
'wave_type': fields.many2one('stock.picking.wave', 'Picking Wave Type'),
}
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
'wave_type': fields.many2many('stock.picking.wave.type', 'stock_picking_wave_type_rel', 'wave_type_id', 'partner_id', 'Picking Wave Type'),
}
class stock_picking_wave_type(osv.osv):
_name = 'stock.picking.wave.type'
_columns = {
'name': fields.char('Type', required=True),
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -24,6 +24,7 @@
<group>
<group>
<field name="partner_id"/>
<field name="wave_type"/>
</group>
<group>
<label for="capacity"/>
@@ -62,6 +63,7 @@
<field name="partner_id"/>
<field name="capacity"/>
<field name="capacity_uom"/>
<field name="wave_type"/>
<field name="time" widget="float_time"/>
<field name="state"/>
</tree>
@@ -117,5 +119,16 @@
</field>
</record>
<record model="ir.ui.view" id="partner_wave_type">
<field name="name">partner.wave.type.view</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='active']" position="after">
<field name="wave_type" widget="many2many_tags"/>
</xpath>
</field>
</record>
</data>
</openerp>
@@ -0,0 +1 @@
import picking_to_wave
@@ -0,0 +1,34 @@
##############################################################################
#
# 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/>.
#
##############################################################################
from openerp.osv import fields, osv
from openerp.tools.translate import _
class stock_picking_to_wave(osv.osv_memory):
_name = 'stock.picking.to.wave'
_description = 'Add pickings to a picking wave'
_columns = {
'wave_id': fields.many2one('stock.picking.wave', 'Picking Wave', required=True),
}
def attach_pickings(self, cr, uid, ids, context=None):
#use active_ids to add picking line to the selected wave
wave_id = self.browse(cr, uid, ids, context=context)[0].wave_id.id
picking_ids = context.get('active_ids', False)
return self.pool.get('stock.picking').write(cr, uid, picking_ids, {'wave_id': wave_id})
@@ -0,0 +1,40 @@
<?xml version="1.0"?>
<openerp>
<data>
<!-- add picking to wave -->
<record model="ir.ui.view" id="picking_to_wave_form">
<field name="name">stock.picking.to.wave.form</field>
<field name="model">stock.picking.to.wave</field>
<field name="arch" type="xml">
<form string="Add pickings to wave" version="7.0">
<separator string="Select a wave"/>
<field name="wave_id" class="oe_inline"/>
<footer>
<button name="attach_pickings" type="object" string="Add to wave" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<!-- add picking to wave action -->
<record model="ir.actions.act_window" id="picking_to_wave_act">
<field name="name">Add to Wave</field>
<field name="res_model">stock.picking.to.wave</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="picking_to_wave_form"/>
<field name="target">new</field>
</record>
<act_window id="action_picking_to_wave"
multi="True"
key2="client_action_multi" name="Add to Wave"
res_model="stock.picking.to.wave" src_model="stock.picking"
view_mode="form" target="new" view_type="form"
/>
</data>
</openerp>