Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] purchase_stock, purchase_mrp: adjust the qty of purchased kit correctly #76965

Conversation

DjamelTouati
Copy link
Contributor

Steps to reproduce the bug:

  • Create a BOM kit for “product K” with:
    • 2 * “product A”
    • 1 * “product B”
  • Create a PO for 1 unit of “product K” > confirm
  • A receipt delivery with 2 units of “product A” and 1 unit of B will be created
  • Modify the ordered Qty to 2 units of “Product K”

Problem:
The receipt delivery will not be updated correctly (4 units of product A and 3 of product B)
because the "_prepare_stock_moves" function computed the previous quantity wrong based on the moves quantities
since the moves are for products A and B, not product F.(do not take into account the products in kit)

Solution:
For kit products, do not calculate from the "stock.move", calculate the difference between the quantity before and after the change

opw-2645719

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo
Copy link
Contributor

robodoo commented Sep 22, 2021

@C3POdoo C3POdoo requested a review from a team September 22, 2021 12:23
@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Sep 22, 2021
@DjamelTouati DjamelTouati force-pushed the 12.0-opw-2645719-adjust_qty_kit_correctly-otd branch from 79b12ee to 0a51ad6 Compare September 23, 2021 07:12
@DjamelTouati DjamelTouati changed the title [FIX] purchase_stock, purchase_mrp: Adjust the qty of purchased kit correctly [FIX] purchase_stock, purchase_mrp: adjust the qty of purchased kit correctly Sep 23, 2021
@DjamelTouati DjamelTouati force-pushed the 12.0-opw-2645719-adjust_qty_kit_correctly-otd branch from 0a51ad6 to 3783d17 Compare September 23, 2021 09:46
@Whenrow
Copy link
Contributor

Whenrow commented Sep 23, 2021

The same scenario in a sale order is correct. We should do the same

@DjamelTouati DjamelTouati force-pushed the 12.0-opw-2645719-adjust_qty_kit_correctly-otd branch from 3783d17 to eb77495 Compare September 27, 2021 15:32
…orrectly

Steps to reproduce the bug:
- Create a BOM kit for “product K”  with:
    - 2 * “product A”
    - 1 * “product B”
- Create a PO for 1 unit of “product K” > confirm
- A receipt delivery with 2 units of “product A” and 1 unit of B will be created
- Modify the ordered Qty to 2 units of “Product K”

Problem:
The receipt delivery will not be updated correctly (4 units of product A and 3 of product B)
because the `"_prepare_stock_moves"` function computed the previous quantity wrong based on the moves quantities
since the moves are for products A and B, not product F.(do not take into account the products in kit)

Solution:
For kit products, do not calculate from the `"stock.move"`, calculate the difference between the quantity before and after the change

opw-2645719
@DjamelTouati DjamelTouati force-pushed the 12.0-opw-2645719-adjust_qty_kit_correctly-otd branch from eb77495 to 509db23 Compare September 28, 2021 15:47
@amoyaux
Copy link
Contributor

amoyaux commented Sep 30, 2021

robodoo r+

robodoo pushed a commit that referenced this pull request Sep 30, 2021
…orrectly

Steps to reproduce the bug:
- Create a BOM kit for “product K”  with:
    - 2 * “product A”
    - 1 * “product B”
- Create a PO for 1 unit of “product K” > confirm
- A receipt delivery with 2 units of “product A” and 1 unit of B will be created
- Modify the ordered Qty to 2 units of “Product K”

Problem:
The receipt delivery will not be updated correctly (4 units of product A and 3 of product B)
because the `"_prepare_stock_moves"` function computed the previous quantity wrong based on the moves quantities
since the moves are for products A and B, not product F.(do not take into account the products in kit)

Solution:
For kit products, do not calculate from the `"stock.move"`, calculate the difference between the quantity before and after the change

opw-2645719

closes #76965

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
@robodoo robodoo closed this Sep 30, 2021
@robodoo robodoo temporarily deployed to merge September 30, 2021 08:35 Inactive
@fw-bot
Copy link
Contributor

fw-bot commented Oct 4, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #77622

@fw-bot
Copy link
Contributor

fw-bot commented Oct 5, 2021

This pull request has forward-port PRs awaiting action (not merged or closed): #77706

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OE the report is linked to a support ticket (opw-...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants