From 713660357eca5ad708252b7e823375c39211e30f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 8 Sep 2022 12:56:39 +0200 Subject: [PATCH] Check if move has shipment before assigning inventory moves The moves on sale line do not always have a shipment, for example for drop shipment. issue11217 review427641003 --- sale.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sale.py b/sale.py index 4f27656e3e..4ffe8fb9ad 100644 --- a/sale.py +++ b/sale.py @@ -220,9 +220,10 @@ class Line(metaclass=PoolMeta): moves = set() for move in self.moves: - for inv_move in move.shipment.inventory_moves: - if inv_move.product.id == self.product.id: - moves.add(inv_move) + if move.shipment: + for inv_move in move.shipment.inventory_moves: + if inv_move.product.id == self.product.id: + moves.add(inv_move) to_write = [] to_assign = [] for move in moves: