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] sale_loyalty: prevent error while remove all product quantities from cart #163055
Closed
mega-odoo
wants to merge
1
commit into
odoo:16.0
from
odoo-dev:16.0-sentry-5119007021-website-sale-loyalty-attribute-error-mega
Closed
[FIX] sale_loyalty: prevent error while remove all product quantities from cart #163055
mega-odoo
wants to merge
1
commit into
odoo:16.0
from
odoo-dev:16.0-sentry-5119007021-website-sale-loyalty-attribute-error-mega
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maan-odoo
reviewed
Apr 24, 2024
… from cart Currently, an error is generated when removing all product quantities from the cart after a claiming a reward(discount). Step to produce: - Install a 'website_sale_loyalty' module. - Navigate to the website / eCommerce / Loyalty / Discount & Loyalty to create a record. - Set the Loyalty Program name and Program Type as 'Loyalty Cards'.(Ensure it's available on sale and the website.) - And add 'Rewards' and set a Reward Type as 'Discount' which is applied to on Cheapest Product. - Go to the website shop add any product on a card, Open a cart increase the quantity of the product, and claim the discount reward. - Again go to Loyalty Program and open Loyalty Card, Open a record and add a Balance(greater than 200 as default reward points are 200) and copy 'Code'. - Again go to the website shop and apply this code to claim a discount after a claim discount. - Now remove all product quantity from a cart. AttributeError: 'bool' object has no attribute 'price_unit' The issue occurs when attempting to remove all product quantities from a cart. At this point [1], a bool value 'False' is returned, and the system attempts to get a value of 'price_unit' from it [2]. link [1]: https://github.com/odoo/odoo/blob/499056a82db26f7d9caa86314e666e2bd49cc79c/addons/sale_loyalty/models/sale_order.py#L187-L195 link [2]: https://github.com/odoo/odoo/blob/499056a82db26f7d9caa86314e666e2bd49cc79c/addons/sale_loyalty/models/sale_order.py#L205 This commit resolve issue, If the _cheapest_line() method returns False then also returns False from _discountable_cheapest(), To raise an error at [3]. link [3]: https://github.com/odoo/odoo/blob/cbc40eccf576c499709f7825edad9a3b3ce7a22d/addons/sale_loyalty/models/sale_order.py#L317-L333 sentry-5119007021
mega-odoo
force-pushed
the
16.0-sentry-5119007021-website-sale-loyalty-attribute-error-mega
branch
from
April 24, 2024 08:52
0083817
to
988bf4f
Compare
Hello @odoo/sentry_reviewers please review this PR. Thank You 🙂 |
anko-odoo
approved these changes
Apr 24, 2024
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 :)
Feyensv
approved these changes
Apr 25, 2024
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.
@robodoo delegate+
@robodoo r+ |
robodoo
pushed a commit
that referenced
this pull request
Apr 25, 2024
… from cart Currently, an error is generated when removing all product quantities from the cart after a claiming a reward(discount). Step to produce: - Install a 'website_sale_loyalty' module. - Navigate to the website / eCommerce / Loyalty / Discount & Loyalty to create a record. - Set the Loyalty Program name and Program Type as 'Loyalty Cards'.(Ensure it's available on sale and the website.) - And add 'Rewards' and set a Reward Type as 'Discount' which is applied to on Cheapest Product. - Go to the website shop add any product on a card, Open a cart increase the quantity of the product, and claim the discount reward. - Again go to Loyalty Program and open Loyalty Card, Open a record and add a Balance(greater than 200 as default reward points are 200) and copy 'Code'. - Again go to the website shop and apply this code to claim a discount after a claim discount. - Now remove all product quantity from a cart. AttributeError: 'bool' object has no attribute 'price_unit' The issue occurs when attempting to remove all product quantities from a cart. At this point [1], a bool value 'False' is returned, and the system attempts to get a value of 'price_unit' from it [2]. link [1]: https://github.com/odoo/odoo/blob/499056a82db26f7d9caa86314e666e2bd49cc79c/addons/sale_loyalty/models/sale_order.py#L187-L195 link [2]: https://github.com/odoo/odoo/blob/499056a82db26f7d9caa86314e666e2bd49cc79c/addons/sale_loyalty/models/sale_order.py#L205 This commit resolve issue, If the _cheapest_line() method returns False then also returns False from _discountable_cheapest(), To raise an error at [3]. link [3]: https://github.com/odoo/odoo/blob/cbc40eccf576c499709f7825edad9a3b3ce7a22d/addons/sale_loyalty/models/sale_order.py#L317-L333 sentry-5119007021 closes #163055 Signed-off-by: Meet Gandhi (mega) <mega@odoo.com>
This was referenced Apr 25, 2024
MohammedBasioni
pushed a commit
to odoo-dev/odoo
that referenced
this pull request
Apr 29, 2024
… from cart Currently, an error is generated when removing all product quantities from the cart after a claiming a reward(discount). Step to produce: - Install a 'website_sale_loyalty' module. - Navigate to the website / eCommerce / Loyalty / Discount & Loyalty to create a record. - Set the Loyalty Program name and Program Type as 'Loyalty Cards'.(Ensure it's available on sale and the website.) - And add 'Rewards' and set a Reward Type as 'Discount' which is applied to on Cheapest Product. - Go to the website shop add any product on a card, Open a cart increase the quantity of the product, and claim the discount reward. - Again go to Loyalty Program and open Loyalty Card, Open a record and add a Balance(greater than 200 as default reward points are 200) and copy 'Code'. - Again go to the website shop and apply this code to claim a discount after a claim discount. - Now remove all product quantity from a cart. AttributeError: 'bool' object has no attribute 'price_unit' The issue occurs when attempting to remove all product quantities from a cart. At this point [1], a bool value 'False' is returned, and the system attempts to get a value of 'price_unit' from it [2]. link [1]: https://github.com/odoo/odoo/blob/499056a82db26f7d9caa86314e666e2bd49cc79c/addons/sale_loyalty/models/sale_order.py#L187-L195 link [2]: https://github.com/odoo/odoo/blob/499056a82db26f7d9caa86314e666e2bd49cc79c/addons/sale_loyalty/models/sale_order.py#L205 This commit resolve issue, If the _cheapest_line() method returns False then also returns False from _discountable_cheapest(), To raise an error at [3]. link [3]: https://github.com/odoo/odoo/blob/cbc40eccf576c499709f7825edad9a3b3ce7a22d/addons/sale_loyalty/models/sale_order.py#L317-L333 sentry-5119007021 closes odoo#163055 Signed-off-by: Meet Gandhi (mega) <mega@odoo.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, an error is generated when removing all product quantities from the cart after a claiming a reward(discount).
Step to produce:
See Traceback:
The issue occurs when attempting to remove all product quantities from a cart. At this point [1], a bool value 'False' is returned, and the system attempts to get a value of 'price_unit' from it [2].
link [1]:
odoo/addons/sale_loyalty/models/sale_order.py
Lines 187 to 195 in 499056a
link [2]:
odoo/addons/sale_loyalty/models/sale_order.py
Line 205 in 499056a
This commit resolves the issue, If the _cheapest_line() method returns False then also returns False from _discountable_cheapest(), To raise an error at [3].
link [3]:
odoo/addons/sale_loyalty/models/sale_order.py
Lines 317 to 333 in cbc40ec
sentry-5119007021
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr