@@ -176,3 +176,40 @@ def test_ensure_no_decrease_product_uom_qty_on_so_cancel(self):
176176 sale .company_id .on_sale_line_cancel_decrease_line_qty = True
177177 sale .action_cancel ()
178178 self .assertEqual (sale .order_line .product_uom_qty , 10 )
179+
180+ def test_cancel_without_move (self ):
181+ sale = self .sale
182+ sale .picking_ids .with_context (
183+ ignore_sale_order_line_cancel = True
184+ ).action_cancel ()
185+ line = self .sale .order_line
186+ self .assertEqual (line .product_uom_qty , 10 )
187+ self .assertEqual (line .qty_to_deliver , 10 )
188+ self .assertEqual (line .product_qty_remains_to_deliver , 10 )
189+ self .assertEqual (line .product_qty_canceled , 0 )
190+ line .cancel_remaining_qty ()
191+ self .assertEqual (line .product_uom_qty , 10 )
192+ self .assertEqual (line .qty_to_deliver , 10 )
193+ self .assertEqual (line .product_qty_remains_to_deliver , 0 )
194+ self .assertEqual (line .product_qty_canceled , 10 )
195+
196+ def test_cancel_without_move_decrease_product_uom_qty (self ):
197+ sale = self .sale
198+ sale .action_cancel ()
199+ sale .picking_ids .unlink ()
200+ sale .action_draft ()
201+ sale .action_confirm ()
202+ sale .picking_ids .with_context (
203+ ignore_sale_order_line_cancel = True
204+ ).action_cancel ()
205+ line = self .sale .order_line
206+ self .assertEqual (line .product_uom_qty , 10 )
207+ self .assertEqual (line .qty_to_deliver , 10 )
208+ self .assertEqual (line .product_qty_remains_to_deliver , 10 )
209+ self .assertEqual (line .product_qty_canceled , 0 )
210+ sale .company_id .on_sale_line_cancel_decrease_line_qty = True
211+ line .cancel_remaining_qty ()
212+ self .assertEqual (line .product_uom_qty , 0 )
213+ self .assertEqual (line .qty_to_deliver , 0 )
214+ self .assertEqual (line .product_qty_remains_to_deliver , 0 )
215+ self .assertEqual (line .product_qty_canceled , 10 )
0 commit comments