odoo/odoo#244875
Created by fw-bot
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: (runtime 1158s)
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:19.0-19.0-opw-5484578-cookies_consent-sben-492336-fw
- head
- 0e89112648760388aca7be63cb328be175c38be9
- merged
- 2 weeks ago by Saif Allah Ben Khalil (sben)
| odoo/odoo | |
|---|---|
| saas-18.2 | #243562 |
| saas-18.3 | #244836 |
| saas-18.4 | #244855 |
| 19.0 | #244875 |
| saas-19.1 | #245138 |
| master | #245148 |
[FIX] website: Save cookie consent with primary button style
Steps to reproduce:
- Enable the Cookies Bar in website settings.
- Go to the website and enter Edit mode.
- Select the Cookie Bar and change the button "I agree" style shape to "Default" (this applies the
.btn-primaryclass). & Save - Accept the cookies & refresh
-> The cookie bar appears again because the consent was not saved.
Cause:
The CookiesBar widget inherits from the generic Popup widget. The Popup class defines a default behavior for elements with the .btn-primary class: clicking them triggers onBtnPrimaryClick, which closes the popup.
By default, the cookie bar button uses .btn-outline-primary, avoiding this behavior. However, when the user changes the style to "Default", the button receives the .btn-primary class. Consequently, the parent Popup handler is triggered. It closes the modal prematurely, interrupting the CookiesBar's specific logic (specifically onAcceptClick),So onHideModal won't be called inside the function, and as a result, the user's consent cookie is never written.
Solution:
Override the event to avoid side effects on hide.
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: #243562