[FIX] stock: action_cancel

When writing several times on the same record in the same transaction,
the orm raise a Missing error because the rowcount only gives one
difference.

opw:666470
This commit is contained in:
Goffin Simon 2016-01-21 14:51:56 +01:00
parent c790464fd6
commit 5009944410
1 changed files with 3 additions and 3 deletions

View File

@ -2361,7 +2361,7 @@ class stock_move(osv.osv):
"""
procurement_obj = self.pool.get('procurement.order')
context = context or {}
procs_to_check = []
procs_to_check = set()
for move in self.browse(cr, uid, ids, context=context):
if move.state == 'done':
raise osv.except_osv(_('Operation Forbidden!'),
@ -2381,11 +2381,11 @@ class stock_move(osv.osv):
self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'}, context=context)
if move.procurement_id:
# Does the same as procurement check, only eliminating a refresh
procs_to_check.append(move.procurement_id.id)
procs_to_check.add(move.procurement_id.id)
res = self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False}, context=context)
if procs_to_check:
procurement_obj.check(cr, uid, procs_to_check, context=context)
procurement_obj.check(cr, uid, list(procs_to_check), context=context)
return res
def _check_package_from_moves(self, cr, uid, ids, context=None):