[FIX]stock_picking_wave: add wave type and wizard to assign picking to wave

bzr revid: csn@openerp.com-20130802121714-j222y9d6r5jwfis6
This commit is contained in:
Cedric Snauwaert 2013-08-02 14:17:14 +02:00
parent d6315438b6
commit b9441ec344
7 changed files with 105 additions and 2 deletions

View File

@ -20,5 +20,6 @@
##############################################################################
import stock_picking_wave
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

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,

View File

@ -13,6 +13,7 @@ class stock_picking_wave(osv.osv):
'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'),
'state': fields.selection([('in_progress', 'Running'), ('done', 'Done')]),
'wave_type': fields.many2one('stock.picking.wave.type', 'Picking Wave Type'),
}
_defaults = {
'name': lambda obj, cr, uid, context: '/',
@ -75,4 +76,17 @@ 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'),
}

View File

@ -25,6 +25,7 @@
<group>
<group>
<field name="partner_id"/>
<field name="wave_type"/>
</group>
<group>
<label for="capacity"/>
@ -45,7 +46,6 @@
<field name="origin"/>
<field name="date"/>
<field name="min_date"/>
<field name="invoice_state" groups="account.group_account_invoice"/>
<field name="stock_journal_id" widget="selection"/>
<field name="state"/>
<button name="action_done" string="Confirm picking" type="object" icon="gtk-apply" attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}"/>
@ -67,6 +67,7 @@
<field name="partner_id"/>
<field name="capacity"/>
<field name="capacity_uom"/>
<field name="wave_type"/>
<field name="time" widget="float_time"/>
</tree>
</field>
@ -115,5 +116,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>

View File

@ -0,0 +1 @@
import picking_to_wave

View File

@ -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 merge(self, cr, uid, ids, context=None):
#use active_ids to add picking line to the selected wave
wave = self.browse(cr, uid, ids, context=context)[0].wave_id.id
picking = context.get('active_ids', False)
return self.pool.get('stock.picking.wave').write(cr, uid, [wave], {'picking_ids': map(lambda x: (4, x, False), picking)}, context=context)

View File

@ -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="merge" 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>