Merge PR #228 into 12.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2021-06-19 17:24:53 +00:00

View File

@@ -133,12 +133,19 @@ class SaleOrderLine(models.Model):
qty = move.product_uom_qty
qty_returned = 0
move_dest = destination_moves(move)
# With the return of the return of the return we could have an
# infinite loop, so we should avoid it dropping already explored
# move_dest_ids
visited_moves = move + move_dest
while move_dest:
qty_returned -= sum(move_dest.mapped("product_uom_qty"))
move_dest = destination_moves(move_dest)
move_dest = destination_moves(move_dest) - visited_moves
if move_dest:
visited_moves += move_dest
qty += sum(move_dest.mapped("product_uom_qty"))
move_dest = destination_moves(move_dest)
move_dest = (
destination_moves(move_dest) - visited_moves
)
# If by chance we get a negative qty we should ignore it
qty = max(0, sum((qty, qty_returned)))
data.append({