Skip to content

Commit 483041b

Browse files
committed
[FIX] sale_order_line_cancel: Restore some features
Allows to check the cancellation on sale order line level Include normal sales (not locked)
1 parent 8e74d07 commit 483041b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sale_order_line_cancel/models/sale_order_line.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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"""

sale_order_line_cancel/wizards/sale_order_line_cancel.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff 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=_(

0 commit comments

Comments
 (0)