Skip to content

Commit 3e85dbe

Browse files
committed
FIX: Handle case where no lines need procurement in _action_launch_stock_rule
1 parent f683b4f commit 3e85dbe

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sale_order_add_byproduct/models/sale_order_line.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@ def _action_launch_stock_rule(self, previous_product_uom_qty=False):
1616
# Filter out lines that were added as MO by-products
1717
# Only trigger stock rules for lines that are NOT by-product lines
1818
lines_to_procure = self.filtered(lambda line: not line.is_mrp_byproduct_line)
19-
19+
2020
# Call the super method with only the filtered lines
21-
return super(SaleOrderLine, lines_to_procure)._action_launch_stock_rule(
22-
previous_product_uom_qty=previous_product_uom_qty
23-
)
21+
# If no lines need procurement, we still need to return the proper result
22+
if lines_to_procure:
23+
return super(SaleOrderLine, lines_to_procure)._action_launch_stock_rule(
24+
previous_product_uom_qty=previous_product_uom_qty
25+
)
26+
else:
27+
# If no lines need procurement, return the same type of result that super would return
28+
# This is typically True for success
29+
return True

0 commit comments

Comments
 (0)