[WIP] Take into account already returned moves
bzr revid: jco@openerp.com-20140129155638-q9nfmm728y2l03ae
This commit is contained in:
@@ -1384,7 +1384,8 @@ class stock_move(osv.osv):
|
||||
default['reserved_quant_ids'] = []
|
||||
default['returned_move_ids'] = []
|
||||
default['linked_move_operation_ids'] = []
|
||||
default['origin_returned_move_id'] = False
|
||||
if not default.get('origin_returned_move_id'):
|
||||
default['origin_returned_move_id'] = False
|
||||
default['state'] = 'draft'
|
||||
return super(stock_move, self).copy_data(cr, uid, id, default, context)
|
||||
|
||||
|
||||
@@ -80,9 +80,11 @@ class stock_return_picking(osv.osv_memory):
|
||||
raise osv.except_osv(_('Warning!'), _('You can not reverse when the chained moves are done!'))
|
||||
#Search quants
|
||||
quant_search = quant_obj.search(cr, uid, ['&', '&', ('history_ids', 'in', move.id), ('qty', '>', 0.0),
|
||||
('location_id', '=', move.location_dest_id.id), ], context=context)
|
||||
# ('reservation_id.origin_returned_move_id', '!=', move.id)
|
||||
quants += [(move.id, x) for x in quant_obj.browse(cr, uid, quant_search, context=context)]
|
||||
('location_id', 'child_of', move.location_dest_id.id), ], context=context)
|
||||
quants += [(move.id, x) for x in quant_obj.browse(cr, uid, quant_search, context=context) if not x.reservation_id or x.reservation_id.origin_returned_move_id.id != move.id]
|
||||
|
||||
# Still need to group by move/product? (move has only one product => ...)
|
||||
|
||||
|
||||
for quant in quants:
|
||||
result1.append({'product_id': quant[1].product_id.id, 'quantity': quant[1].qty, 'move_id': quant[0]})
|
||||
|
||||
Reference in New Issue
Block a user