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 into
OCA: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 into
OCA: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.

@JordiMForgeFlow JordiMForgeFlow left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

code LGTM 👍🏼

@GuillemCForgeFlow GuillemCForgeFlow left a comment

Copy link
Copy Markdown

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

@BhaveshHeliconia BhaveshHeliconia 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.

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

@pedrobaeza pedrobaeza left a comment

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.

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

Comment thread stock_picking_report_valued_sale_mrp/models/stock_move.py Outdated
@rrebollo rrebollo force-pushed the 16.0-stock_picking_report_valued_sale_mrp-fix-components-per-kit-when-redelivering branch from 8610353 to 0eb42b7 Compare May 4, 2026 18:43
@OCA-git-bot OCA-git-bot added mod:stock_picking_report_valued_sale_mrp Module stock_picking_report_valued_sale_mrp series:16.0 labels May 4, 2026
@rrebollo rrebollo requested a review from pedrobaeza May 4, 2026 18:48
@rrebollo

rrebollo commented May 4, 2026

Copy link
Copy Markdown
Author

@pedrobaeza what do U think? can we merge it now?

line.quantity_done = line.product_uom_qty
return_picking.button_validate()
# Redelivery
sale._action_cancel()

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.

This is not the usual flow, but to return the return, so I'm not doubting your code serves for this purpose.

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.

Do you mean "now doubting"? The first one to question my code was me:

🛠️ 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.

The issue is documented in #451. Please take some time to suggest a better approach if you have one.

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.

@pedrobaeza, now I understand your point. The usual flow is to return the return not to cancel the return. I need to dig deeper into those scenarios. Thank you.

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

Labels

mod:stock_picking_report_valued_sale_mrp Module stock_picking_report_valued_sale_mrp series:16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants