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

[15.0][FIX] base_product_mass_addition: _complete_quick_line_vals function. #1604

Merged

Conversation

angelgarciadelachica
Copy link

@angelgarciadelachica angelgarciadelachica commented May 3, 2024

There is a bug in the _complete_quick_line_vals() function that causes incorrect operation when lines are added with the purchase_quick wizard with the same discount as in the first line.

To reproduce the bug:

  1. Create a purchase quotation.

  2. Use the purchase wizard to add a product with one or more discounts -> The line is generated correctly:
    Captura desde 2024-05-03 15-17-25

  3. Now add another line with the same discount values as line 1 -> The discounts are not added:
    Captura desde 2024-05-03 15-15-36

More details:
When the _complete_quick_line_vals() function of the ProductMassAddition model of the base_product_mass_addition module has more than one line, the line that makes the call to the play_onchanges() function of the onchange_helper module is the first one.

https://github.com/OCA/product-attribute/blob/5dd6892879d238330d191cd9b8a16f94cd26b15f/base_product_mass_addition/models/product_mass_addition.py#L71C1-L72C32

This causes the onchange of the discounts not to be executed, since the value coming to it through line 1 is the same as the value of the line being created.

Proposed solution
Create an empty lines_key record and have this be the one to call the onchange_helper() function.

To test this PR -> PR OCA/purchase-workflow#2265 with the reference to this PR

[T-5877]

@angelgarciadelachica
Copy link
Author

@ValentinVinagre
Copy link

@luis-ron

Copy link

@ValentinVinagre ValentinVinagre left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏻

Copy link
Contributor

@luis-ron luis-ron left a comment

Choose a reason for hiding this comment

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

Functional review: LGTM 👍🏻

@OCA-git-bot
Copy link
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). 🤖

@HaraldPanten
Copy link

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 15.0-ocabot-merge-pr-1604-by-HaraldPanten-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 4801189 into OCA:15.0 May 23, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 50e3e48. Thanks a lot for contributing to OCA. ❤️

@HaraldPanten HaraldPanten deleted the 15.0-fix-base_product_mass_addition branch May 23, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants