Skip to content

Commit 853db4b

Browse files
ppyczkopeluko00
authored andcommitted
[IMP] fieldservice_sale_stock: Ensure one stock picking is linked to one FSM order
1 parent 0c064e5 commit 853db4b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

fieldservice_sale_stock/models/sale_order.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,14 @@ def prepare_fsm_values_for_stock_picking(self, fsm_order):
1818

1919
def _link_pickings_to_fsm(self):
2020
for rec in self:
21-
# TODO: We may want to split the picking to have one picking
22-
# per FSM order
2321
fsm_order = self.env["fsm.order"].search(
2422
[
2523
("sale_id", "=", rec.id),
2624
("sale_line_id", "=", False),
25+
("is_closed", "=", False),
2726
]
2827
)
29-
if rec.procurement_group_id:
30-
rec.procurement_group_id.fsm_order_id = fsm_order.id or False
31-
for picking in rec.picking_ids:
28+
for picking in rec.picking_ids.filtered(lambda r: r.state != "cancel"):
3229
picking.write(rec.prepare_fsm_values_for_stock_picking(fsm_order))
3330
for move in picking.move_ids:
3431
move.write(rec.prepare_fsm_values_for_stock_move(fsm_order))

0 commit comments

Comments
 (0)