From ca041ac63170ceb01c5af7a891f40241b97efdc0 Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Thu, 30 Jan 2014 11:58:01 +0100 Subject: [PATCH] [FIX]picking_wave: rename partner_id into user_id and change method done to work with list of ids bzr revid: csn@openerp.com-20140130105801-gi35yjv7yowrxaua --- addons/stock_picking_wave/stock_picking_wave.py | 13 +++++++------ .../stock_picking_wave/stock_picking_wave_view.xml | 8 ++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/addons/stock_picking_wave/stock_picking_wave.py b/addons/stock_picking_wave/stock_picking_wave.py index 50df7dd6d3e..55e6ac1bf6d 100644 --- a/addons/stock_picking_wave/stock_picking_wave.py +++ b/addons/stock_picking_wave/stock_picking_wave.py @@ -7,7 +7,7 @@ class stock_picking_wave(osv.osv): _order = "name desc" _columns = { 'name': fields.char('name', required=True, help='Name of the picking wave'), - 'partner_id': fields.many2one('res.users', 'Responsible', help='Person responsible for this wave'), + 'user_id': fields.many2one('res.users', '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'), @@ -68,12 +68,13 @@ class stock_picking_wave(osv.osv): def done(self, cr, uid, ids, context=None): #done should only be called from one wave at a time picking_todo = [] - for picking in self.browse(cr, uid, ids, context=context)[0].picking_ids: - if picking.state not in ('cancel', 'done', 'assigned'): - raise osv.except_osv(_('Warning'),_('Some pickings are still waiting for goods. Please check them before setting them to done')) - picking_todo.append(picking.id) + for wave in self.browse(cr, uid, ids, context=context): + for picking in wave.picking_ids: + if picking.state not in ('cancel', 'done', 'assigned'): + raise osv.except_osv(_('Warning'),_('Some pickings are still waiting for goods. Please check them before setting them to done')) + picking_todo.append(picking.id) if picking_todo: - self.pool.get('stock.picking').action_done(cr, uid, picking_todo, context=context) + self.pool.get('stock.picking').action_done(cr, uid, list(set(picking_todo)), context=context) return self.write(cr, uid, ids, {'state': 'done'}, context=context) diff --git a/addons/stock_picking_wave/stock_picking_wave_view.xml b/addons/stock_picking_wave/stock_picking_wave_view.xml index 1aa8e9deae9..4486bd6761b 100644 --- a/addons/stock_picking_wave/stock_picking_wave_view.xml +++ b/addons/stock_picking_wave/stock_picking_wave_view.xml @@ -22,7 +22,7 @@ - +