From 306222ae7fc8e0b26ba02b09596a8e99f3085166 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Wed, 31 Jul 2013 15:28:36 +0200 Subject: [PATCH] [FIX]picking wave: search view, sequence for name, improve usability view, add state bzr revid: csn@openerp.com-20130731132836-us42370uutg1dbug --- addons/stock_picking_wave/__openerp__.py | 3 +- .../stock_picking_wave/stock_picking_wave.py | 25 ++++++ .../stock_picking_wave_view.xml | 88 ++++++++++++------- 3 files changed, 82 insertions(+), 34 deletions(-) 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 04b4378409f..bf66bc3269f 100644 --- a/addons/stock_picking_wave/stock_picking_wave.py +++ b/addons/stock_picking_wave/stock_picking_wave.py @@ -12,7 +12,13 @@ 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')]), } + _defaults = { + 'name': lambda obj, cr, uid, context: '/', + '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) @@ -45,6 +51,25 @@ 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 '/' + if context is None: + context = {} + 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, 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 87164c64171..ecce73e098a 100644 --- a/addons/stock_picking_wave/stock_picking_wave_view.xml +++ b/addons/stock_picking_wave/stock_picking_wave_view.xml @@ -5,42 +5,53 @@ stock.picking.wave
+
+
-
- - - - - - - - - - - - - - - - - - - -