[FIX] Regression in SO from Jeroen and Jay, picked state see bug #491375

bzr revid: fp@tinyerp.com-20091203173113-a6j7av8brwf36ao9
This commit is contained in:
Fabien Pinckaers 2009-12-03 18:31:13 +01:00
parent b78474e680
commit 198bc60289
1 changed files with 3 additions and 17 deletions

View File

@ -506,23 +506,9 @@ class sale_order(osv.osv):
write_cancel_ids = []
stock_move_obj = self.pool.get('stock.move')
for order in self.browse(cr, uid, ids, context={}):
#check for pending deliveries
pending_deliveries = False
# check => if order_lines do not exist,don't proceed for any mode.
if not order.order_line:
return False
for line in order.order_line:
move_ids = stock_move_obj.search(cr, uid, [('sale_line_id','=', line.id)])
for move in stock_move_obj.browse( cr, uid, move_ids ):
#if one of the related order lines is in state draft, auto or confirmed
#this order line is not yet delivered
if move.state in ('draft', 'auto', 'confirmed'):
pending_deliveries = True
# Reason => if there are no move lines,the following condition will always set to be true,and will set SO to 'DONE'.
# Added move_ids check to SOLVE.
if move_ids and ((not line.procurement_id) or (line.procurement_id.state=='done')) and not pending_deliveries:
# finished = True
for line in order.order_line:
if (not line.procurement_id) or (line.procurement_id.state=='done'):
finished = True
if line.state != 'done':
write_done_ids.append(line.id)
else: