File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def _compute_can_cancel_remaining_qty(self):
3333 rec .product_qty_remains_to_deliver , 0 , precision_digits = precision
3434 )
3535 == 1
36- and rec .state == " done"
36+ and rec .state in ( "sale" , " done")
3737 and rec .move_ids
3838 )
3939
@@ -48,3 +48,6 @@ def _compute_product_qty_remains_to_deliver(self):
4848 line .product_uom_qty - line .qty_delivered - line .product_qty_canceled
4949 )
5050 line .product_qty_remains_to_deliver = remaining_to_deliver
51+
52+ def _check_moves_to_cancel (self , moves ):
53+ """override this method to add checks before cancel"""
Original file line number Diff line number Diff line change @@ -21,15 +21,12 @@ def _get_sale_order_line(self):
2121 def _get_moves_to_cancel (self , line ):
2222 return line .move_ids .filtered (lambda m : m .state not in ("done" , "cancel" ))
2323
24- def _check_moves_to_cancel (self , moves ):
25- """override this method to add checks before cancel"""
26-
2724 def cancel_remaining_qty (self ):
2825 line = self ._get_sale_order_line ()
2926 if not line .can_cancel_remaining_qty :
3027 return False
3128 cancel_moves = self ._get_moves_to_cancel (line )
32- self ._check_moves_to_cancel (cancel_moves )
29+ line ._check_moves_to_cancel (cancel_moves )
3330 cancel_moves ._action_cancel ()
3431 line .order_id .message_post (
3532 body = _ (
You can’t perform that action at this time.
0 commit comments