-
-
Notifications
You must be signed in to change notification settings - Fork 721
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
[15.0][FIX] base_product_mass_addition: _complete_quick_line_vals function. #1604
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional review: LGTM 👍🏻
This PR has the |
/ocabot merge patch |
On my way to merge this fine PR! |
Congratulations, your PR was merged at 50e3e48. Thanks a lot for contributing to OCA. ❤️ |
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:
Create a purchase quotation.
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](https://private-user-images.githubusercontent.com/101106685/327766147-6aea5b4d-985d-44d6-a71c-5d46e4051c3e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjQ5NjMsIm5iZiI6MTczOTU2NDY2MywicGF0aCI6Ii8xMDExMDY2ODUvMzI3NzY2MTQ3LTZhZWE1YjRkLTk4NWQtNDRkNi1hNzFjLTVkNDZlNDA1MWMzZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQyMDI0MjNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mNTJlY2I5YTg2ODUwYzNjNjdlOTA2MzE1ODU4ZDMxMjM1MGUxNTM4ZmVhM2NiNWZlZmYzNTA4MzhjYTExZmJmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.RE4hFYmzuXwpNuDiqdS8-u96zQYZRLfH-G7xdDqoquE)
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](https://private-user-images.githubusercontent.com/101106685/327766432-7cf600c3-28df-4b40-9317-2ea881c2cbfe.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjQ5NjMsIm5iZiI6MTczOTU2NDY2MywicGF0aCI6Ii8xMDExMDY2ODUvMzI3NzY2NDMyLTdjZjYwMGMzLTI4ZGYtNGI0MC05MzE3LTJlYTg4MWMyY2JmZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQyMDI0MjNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yZWMzYWQzMzJkZWJjZGI5OWIzZjZlMWQwY2Y5ZTM0MGVlY2NkMDk2Yzc1NGMxODEyNDNjMjVhZjE0NTNjZTExJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.J_WBVTLGVKgDkHsEuJOAptVoAku4wadKG79vEdSBxgs)
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 theplay_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 theonchange_helper()
function.To test this PR -> PR OCA/purchase-workflow#2265 with the reference to this PR
[T-5877]