[18.0][FIX] stock_picking_origin_reference_sale: set origin_reference from Sales Order ignoring customer reference #2121
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the issue:
When a Sales Order has a Customer Reference (
client_order_ref
), the Delivery Orderorigin
field includes both the SO name and the customer reference (e.g., "SO00029 - ABC123").This prevents the Delivery Order from having a clickable link to the originating Sales Order.
Current behavior:
origin
= "SO00029 - ABC123" (plain text)Expected behavior:
origin_reference
field.origin
field can still show the descriptive text including the customer reference.Solution implemented:
convert_origin
method to extract only the SO name fromorigin
._compute_origin_reference
to search for the SO using the extracted name and setorigin_reference
.origin
.Affected versions:
Example:
origin
= "SO00029 - ABC123"origin_reference
= "sale.order,42" (clickable link to SO)Impact
Restores expected behavior of the Delivery Orders by ensuring the Source Document link (origin_reference) correctly points to the originating Sales Order, even when a Customer Reference is present.
Fixes issue #2116