[FIX] stock: Returning canceled moves

Steps to reproduce the bug:

- Let's consider two storable products P1 and P2 from the same vendor V
- P1 and P2 have the routes 'Buy' and 'Make to order'
- Create a SO for 1 P1 and 1 P2 and confirm it
- A delivery order DO has been created
- A PO has been created for V, confirm it
- Process the shipment, receive 1 P1 and 0 P2 with no backorder
- Process DO with no backorder
- Return DO by clicking on 'Return' button

Bug:

1 P1 and 1 P2 were suggested to be returned but the movement for P2 had been canceled.

Closes #39547
opw:2116582

closes odoo/odoo#40220

X-original-commit: bb94b6591fb148a4c1b94f9c28d2c10e44e12283
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-11-13 16:05:55 +00:00
committed by fw-bot
parent eb89927019
commit 9713d66a15
@@ -50,6 +50,8 @@ class ReturnPicking(models.TransientModel):
if self.picking_id and self.picking_id.state != 'done':
raise UserError(_("You may only return Done pickings."))
for move in self.picking_id.move_lines:
if move.state == 'cancel':
continue
if move.scrapped:
continue
if move.move_dest_ids: