Skip to content

[16.0][FIX] shopfloor: handle multiple move lines in location content transfer - #1303

Open
nicolas-delbovier-acsone wants to merge 3 commits into
OCA:16.0from
acsone:16.0-fix-shopfloor-location-content-transfer-handle-multiple-move-lines-for-one-move
Open

nicolas-delbovier-acsone wants to merge 3 commits into
OCA:16.0from
acsone:16.0-fix-shopfloor-location-content-transfer-handle-multiple-move-lines-for-one-move

Conversation

@nicolas-delbovier-acsone

@nicolas-delbovier-acsone nicolas-delbovier-acsone commented Oct 16, 2026 •

Copy link
Copy Markdown

Fix premature auto-validation of sibling move lines in location_content_transfer

Problem

When processing transfers via the Location Content Transfer service in "process by line" mode (go_to_single), validating a single stock.move.line invokes stock.validate_moves(move_line.move_id) without splitting the done move line from the (potential) others first.

If a single stock.move contained multiple stock.move.line records (such as when demand is satisfied across multiple lots), validating the parent move_id caused Odoo to validate all related move lines at once. As a result, completing the first scanned line automatically completed remaining sibling lines without requiring the operator to scan them in Shopfloor.

Notes

  • This PR also fixes a regression introduced in [16.0][FIX] shopfloor: Don't embed postponed line quantity #911 where postponing a move line reset its qty_done to 0. Because _find_transfer_move_lines filters out lines with qty_done <= 0, postponed lines were subsequently ignored instead of being proposed back to the operator.
  • This PR fixes the unit test test_postpone_line_ok_with_two_lines_and_view (also introduced in [16.0][FIX] shopfloor: Don't embed postponed line quantity #911): that test was testing something impossible to do from UI. You can not create an LOC picking for 2 move lines in 2 different sub-locations. If you create such a picking by hand, scanning the parent location through UI would split one move line into a split order and thus only present you one of them to process.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @jbaudoux, @mmequignon, @TDu, @sebalix, @simahawk,
some modules you are maintaining are being modified, check this out!

@nicolas-delbovier-acsone
nicolas-delbovier-acsone force-pushed the 16.0-fix-shopfloor-location-content-transfer-handle-multiple-move-lines-for-one-move branch 2 times, most recently from 9f4f1d8 to 5484fd7 Compare October 16, 2026 14:59
@nicolas-delbovier-acsone nicolas-delbovier-acsone changed the title [16.0][IMP] shopfloor: handle multiple move lines in location content transfer [16.0][FIX] shopfloor: handle multiple move lines in location content transfer Oct 16, 2026

@jbaudoux jbaudoux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your fix for the 2 move lines cases looks good.
However, for the partial quantity, there is another call missing to split the move line.

Comment on lines 922 to 924
# ↓ Necessary in case of partial because `qty_done = move_line.reserved_uom_qty`
# since we made a "mark_move_line_as_picked"
move_line.qty_done = quantity

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you decrease the quantity, we need to split the move line for the processed quantity.

@nicolas-delbovier-acsone nicolas-delbovier-acsone Nov 17, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did the test, I think the splitting is working as expected. Have a look:

Setup:

  • A picking (WH/LCT/00008) with one move for 10 qty and 2 move lines (each for 5 qty)
  • In shopfloor, click on "Process by line" to process first line of the picking
  • Only process 3/5 qty of the move line
image image image

This comes from this code inside set_destination_line:

# create the split order (WH/LCT/00009)
move_line._extract_in_split_order()

# create the backorder (WH/LCT/00010)
backorders = stock.validate_moves(move_line.move_id)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's my point. If there is 5 to do and you do 2, a split order LCT/00010 must be created for the processed 2, and the remaining 3 should still be there to process in the initial LCT/00009.

Here, the code thinks everything was done (because you processed the last move line) and launches the backorder procedure at validation. But this is wrong because if you split the move line for the processed quantity, it will detect that not everything is done and do this extract in split order.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you replaced it by a call to mark_move_line_as_picked. Can you add a test for this with a line partially processed?

@nicolas-delbovier-acsone
nicolas-delbovier-acsone force-pushed the 16.0-fix-shopfloor-location-content-transfer-handle-multiple-move-lines-for-one-move branch 2 times, most recently from 6a70748 to 54b3138 Compare November 18, 2026 09:13
Comment on lines -352 to -360
def shopfloor_postpone(self, *recordsets):
"""
Specific behavior for move lines.
As we need to reset qty_done.

"""
res = super().shopfloor_postpone(*recordsets)
self.qty_done = 0.0
return res

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was likely for the cluster picking. You should probably add it there after the call to this method.

Co-authored-by: Jacques-Etienne Baudoux <je@bcim.be>
…rtial transfers

Mixing split orders and backorders made transfer tracking overly complex and hard to follow. Partial transfers now rely exclusively on split orders to extract validated quantities from the original picking.
@nicolas-delbovier-acsone
nicolas-delbovier-acsone force-pushed the 16.0-fix-shopfloor-location-content-transfer-handle-multiple-move-lines-for-one-move branch from 54b3138 to 8ef69cc Compare November 20, 2026 13:59
@nicolas-delbovier-acsone

nicolas-delbovier-acsone commented Nov 20, 2026 •

Copy link
Copy Markdown
Author

@jbaudoux The last implementation gets rid of backorders to only rely on split orders. Here is a screenshot to show what happens when we process:

  • (3/5) move line 1 (red)
  • (2/2) remaining of move line 1 (green)
  • (5/5) move line 2 (purple)
image

Is that what you had in mind?

Note that code on the backorder policy: I adapted the code to make tests pass but... Do we need to keep this? I am not sure since we do not rely on "backorders" anymore. WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants