46
46
for dispatch_id in ids:
47
47
result[dispatch_id] = []
48
sql = ("SELECT sm.dispatch_id, sm.picking_id FROM stock_move sm "
48
sql = ("SELECT DISTINCT sm.dispatch_id, sm.picking_id FROM stock_move sm "
49
49
"WHERE sm.dispatch_id in %s AND sm.picking_id is NOT NULL")
50
50
cr.execute(sql, (tuple(ids),))
51
51
res = cr.fetchall()
57
'name': fields.char('Name', size=64, required=True, select=True,
57
'name': fields.char('Name', size=96, required=True, select=True,
58
58
states={'draft': [('readonly', False)]}, unique=True,
59
59
help='Name of the picking dispatch'),
60
60
'date': fields.date('Date', required=True, readonly=True, select=True,
61
states={'draft': [('readonly', False)]},
61
states={'draft': [('readonly', False)],
62
'assigned': [('readonly', False)]},
62
63
help='date on which the picking dispatched is to be processed'),
63
64
'picker_id': fields.many2one('res.users', 'Picker', readonly=True, required=True,
64
states={'draft': [('readonly', False)]}, select=True,
65
help='the user to which the pickings are assigned'),
65
states={'draft': [('readonly', False)],
66
'assigned': [('readonly', False)]},
68
help='the user to which the pickings are assigned'),
66
69
'move_ids': fields.one2many('stock.move', 'dispatch_id', 'Moves',
67
70
states={'draft': [('readonly', False)]},
69
72
help='the list of moves to be processed'),
73
'notes': fields.text('Notes', help='free form remarks'),
70
74
'backorder_id': fields.many2one('picking.dispatch', 'Back Order of',
71
75
help='if this dispatch was split, this links to the dispatch order containing the other part which was processed',
199
203
for dispatch_id, move_ids in maybe_finished_dispatches.iteritems():
200
204
move_obj.write(cr, uid, move_ids, {'dispatch_id': dispatch_id})
201
205
dispatch_obj.check_finished(cr, uid, list(maybe_finished_dispatches), context)
206
dispatch_obj.write(cr, uid, list(unfinished_dispatch_ids), {'state': 'assigned'})
202
207
return complete_move_ids
228
233
def action_done(self, cr, uid, ids, context=None):
230
in addition to the parent method does, set the dispatch done if all moves are done or cancelled
235
in addition to the parent method does, set the dispatch done if all moves are done or canceled
232
237
_logger.debug('done stock.moves %s', ids)
233
238
status = super(StockMove, self).action_done(cr, uid, ids, context)