[FIX] stock, sale_stock: blocking a process twice due to cancelled moves

This commit is contained in:
Wolfgang Taferner
2017-10-17 16:05:53 +02:00
committed by Simon Lejeune
parent 90d9605c86
commit c30f8c50a3
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -225,7 +225,7 @@ class SaleOrderLine(models.Model):
if line.state != 'sale' or not line.product_id.type in ('consu','product'):
continue
qty = 0.0
for move in line.move_ids:
for move in line.move_ids.filtered(lambda r: r.state != 'cancel'):
qty += move.product_qty
if float_compare(qty, line.product_uom_qty, precision_digits=precision) >= 0:
continue
+2
View File
@@ -912,6 +912,8 @@ class StockMove(models.Model):
if any(move.state == 'done' for move in self):
raise UserError(_('You cannot cancel a stock move that has been set to \'Done\'.'))
for move in self:
if move.state == 'cancel':
continue
move._do_unreserve()
siblings_states = (move.move_dest_ids.mapped('move_orig_ids') - move).mapped('state')
if move.propagate: