[FIX] stock, sale_stock: blocking a process twice due to cancelled moves
This commit is contained in:
committed by
Simon Lejeune
parent
90d9605c86
commit
c30f8c50a3
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user