Skip to content

[16.0] [FIX] stock_picking_report_valued_sale_mrp: fix components per kit computation when redelivering#454

Open
rrebollo wants to merge 2 commits intoOCA:16.0from
BinhexTeam:16.0-stock_picking_report_valued_sale_mrp-fix-components-per-kit-when-redelivering
Open

[16.0] [FIX] stock_picking_report_valued_sale_mrp: fix components per kit computation when redelivering#454
rrebollo wants to merge 2 commits intoOCA:16.0from
BinhexTeam:16.0-stock_picking_report_valued_sale_mrp-fix-components-per-kit-when-redelivering

Conversation

@rrebollo
Copy link
Copy Markdown

Fixes #451

This PR contains two commits:

  1. Adds a test that reproduces the issue.
  2. Introduces a proposed fix for the issue.

🧩 Context

The problem occurs in the following workflow:

  1. Sell a kit.
  2. Confirm the Sales Order (SO).
  3. Validate the related picking.
  4. Return the picking.
  5. Cancel the SO.
  6. Set the SO back to draft.
  7. Confirm the SO again.

At this point, the system generate another picking and you validate this too, and we noticed that the kit component quantities shown on the delivery slip report were incorrect.

🔍 Root Cause

The issue appears to stem from the calculation of the component quantities per kit during this sequence of operations.

🛠️ Proposed Fix

This PR provides an initial attempt to resolve the incorrect quantity computation. Additional details and discussion can be found in the linked issue.

HT14789
@BinhexTeam

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @chienandalu,
some modules you are maintaining are being modified, check this out!

@rrebollo rrebollo marked this pull request as ready for review November 19, 2025 23:54
@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

Copy link
Copy Markdown

@JordiMForgeFlow JordiMForgeFlow left a comment

Choose a reason for hiding this comment

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

code LGTM 👍🏼

Copy link
Copy Markdown

@GuillemCForgeFlow GuillemCForgeFlow left a comment

Choose a reason for hiding this comment

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

code LGTM 👍🏿

@OCA-git-bot
Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@rrebollo
Copy link
Copy Markdown
Author

@rousseldenis could you merge this one?

@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Mar 29, 2026
Copy link
Copy Markdown
Contributor

@BhaveshHeliconia BhaveshHeliconia left a comment

Choose a reason for hiding this comment

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

LGTM!

@rrebollo
Copy link
Copy Markdown
Author

@pedrobaeza could U merge this one?

@pedrobaeza pedrobaeza added this to the 16.0 milestone Apr 30, 2026
Copy link
Copy Markdown
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

Don't introduce extra empty lines inside methods, and please reduce AI usage to the minimum, as the code is bloated due to it.

)

kit_moves_to_sum = kit_moves.filtered(lambda x: not x.origin_returned_move_id)
kit_moves_to_subtract = kit_moves - kit_moves_to_sum
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of complicating this way, just sum the proper moves.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants