diff --git a/addons/stock_picking_wave/__openerp__.py b/addons/stock_picking_wave/__openerp__.py index f20f853d0c0..581d59a2bd6 100644 --- a/addons/stock_picking_wave/__openerp__.py +++ b/addons/stock_picking_wave/__openerp__.py @@ -31,7 +31,8 @@ This module adds the picking wave option in warehouse management. 'website': 'http://www.openerp.com', 'depends': ['stock'], 'data': ['security/ir.model.access.csv', - 'stock_picking_wave_view.xml'], + 'stock_picking_wave_view.xml', + 'stock_picking_wave_sequence.xml'], 'demo': [], 'installable': True, 'auto_install': True, diff --git a/addons/stock_picking_wave/stock_picking_wave.py b/addons/stock_picking_wave/stock_picking_wave.py index fd065397a66..fea3518061b 100644 --- a/addons/stock_picking_wave/stock_picking_wave.py +++ b/addons/stock_picking_wave/stock_picking_wave.py @@ -11,7 +11,12 @@ 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'), + 'state': fields.selection([('in_progress', 'Running'), ('done', 'Done')], required=True), } + _defaults = { + 'name': '/', + 'state': 'in_progress', + } 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) @@ -42,6 +47,23 @@ class stock_picking_wave(osv.osv): 'nodestroy': True } + def create(self, cr, uid, vals, context=None): + if vals.get('name', '/') == '/': + vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'picking.wave') or '/' + return super(stock_picking_wave, self).create(cr, uid, vals, context=context) + + def copy(self, cr, uid, id, default=None, context=None): + if not default: + default = {} + default.update({ + 'state': 'in_progress', + 'name': self.pool.get('ir.sequence').get(cr, uid, 'picking.wave'), + }) + return super(stock_picking_wave, self).copy(cr, uid, id, default=default, context=context) + + def done(self, cr, uid, ids, context=None): + return self.write(cr, uid, ids, {'state': 'done'}, context=context) + class stock_picking(osv.osv): _inherit = "stock.picking" diff --git a/addons/stock_picking_wave/stock_picking_wave_view.xml b/addons/stock_picking_wave/stock_picking_wave_view.xml index a0cfde33277..e9043411d8f 100644 --- a/addons/stock_picking_wave/stock_picking_wave_view.xml +++ b/addons/stock_picking_wave/stock_picking_wave_view.xml @@ -5,41 +5,51 @@ stock.picking.wave
+
+
-
- - - - - - - - - - - - - - - - - - -