-
-
Notifications
You must be signed in to change notification settings - Fork 497
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
[16.0][FIX]website_sale_hide_price: fix button visibility issue #986
[16.0][FIX]website_sale_hide_price: fix button visibility issue #986
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.
Is it ready for review or did you open it in draft by mistake?
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, thanks
1fe61b3
to
cc3b092
Compare
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.
@pilarvargas-tecnativa could take a look?
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.
I don't see any difference in the behaviour of the module with this FIX, can you put an indicative image of the problem? I can't reproduce the problem you are referring to outside this PR.
Ok, now I understand the problem. Maybe with this solution you don't have to apply that condition to other buttons at template level. For example those in some snippets. |
I noticed this issue persists in version 17.0. To address it, I created a forward-port with the necessary adjustments. You can review the pull request here: #987. |
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.
Having a method that determines the visibility and override it makes it more inheritable that touching the QWeb template, so let's go with the change:
/ocabot merge patch
This PR looks fantastic, let's merge it! |
@pedrobaeza your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-986-by-pedrobaeza-bump-patch. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
@LuisAlejandroS it seems the tests are failing. |
Hi, Tests that are failing are related to module In fact, if you just install As you are the authors of this module, could you please take a look at this? Thanks! Regards. |
Well, this was not failing before your patch, and that's because views are enable on demand on tests, so you should find a way to coexist both modules. One option is to incorporate on the code a check on If you don't find a solution, we will need to revert the 17.0 PR for not having the problem on the future. |
To be honest, I don't see that point. There is a clear bug in There is a third module, I didn't pretend you to fix |
A solution at view level would be to incorporate in the t-if the existing conditions in the odoo base view + the conditions added by this module that cause the error when overwriting the whole t-if. At code level it is a good solution but it seems to cause conflict in this version. Or what @pedrobaeza said, add a context to the tests. |
But we don't see why adding more conditions to the |
As said, it's not a problem in the other module, as how tests are executed, they are correct. The status quo is broken with this change. |
2583773
to
6498f80
Compare
@pedrobaeza Hi! I’ve made a small adjustment to ensure the tests for your module don’t break. Feel free to review it whenever you have the chance. Thanks in advance! |
self.env["website"].get_current_website().website_show_price | ||
and not self.website_hide_price | ||
) | ||
if config["test_enable"]: |
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.
You have to test also for a specific context (like website_sale_hide_price_test
), for allowing to check the functionality in this module (if having tests).
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.
@pedrobaeza I’ve just made the changes. Could you please check if this works for you now? Thanks for your time!
Replaced view inheritance with Python logic in _website_show_quick_add to fix an issue where the "Add to Cart" button visibility was incorrectly overridden by this module. This update restores the expected behavior by ensuring the inherited logic determines button visibility.
6498f80
to
0e54d0b
Compare
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.
/ocabot merge patch
On my way to merge this fine PR! |
Congratulations, your PR was merged at da1a745. Thanks a lot for contributing to OCA. ❤️ |
Description:
In the website_sale_hide_price module, button visibility for the "Quick Add to Cart" button in the ecommerce product list (Kanban or List View) was not behaving as expected when the stock was zero and the "Allow out of stock order" option was unchecked. This PR resolves the issue by replacing view inheritance with logic in Python.
Cases covered with this improvement:
Reproduction Steps (in Runboat):
Solution:
The issue was fixed by modifying the _website_show_quick_add method in the product.template model to include logic for checking stock availability and the "Allow out of stock order" option in Python, instead of relying on view inheritance.
This approach ensures better maintainability and resolves the dependency issues that caused the button visibility error.
FL-556-4678