[IMP] website_sale_aplicoop: disable standard website_sale cart — hide header cart, remove add-to-cart, redirect cart routes to /eskaera

This commit is contained in:
snt 2026-05-19 17:10:29 +02:00 committed by GitHub Copilot
parent 3ca90578ae
commit 8f7eca45b8
2 changed files with 74 additions and 5 deletions

View file

@ -141,3 +141,49 @@ This module was inspired by the original **Aplicoop** project:
* Original creators: Ekaitz Mendiluze, Joseba Legarreta, and other contributors * Original creators: Ekaitz Mendiluze, Joseba Legarreta, and other contributors
The original Aplicoop project served as a pioneering solution for collaborative consumption group orders, and this module brings its functionality to the modern Odoo platform. The original Aplicoop project served as a pioneering solution for collaborative consumption group orders, and this module brings its functionality to the modern Odoo platform.
Notes - Shop behaves as a simple catalog
=========================================
Starting with the recent update, this module converts the default Odoo
``/shop`` storefront into a simple product catalog (no standard ``website_sale``
shopping cart). The change is intentional for sites that use the Aplicoop
"eskaera" flow as the single shopping experience.
What the module does
---------------------
- Hides the standard header cart link and badge.
- Removes the "Add to cart" quick-add area from product listings.
- Redirects standard cart endpoints to the group-order flow (``/eskaera``):
``/shop/cart``, ``/shop/cart/update``, ``/shop/cart/update_json``, ``/shop/cart_quantity``.
Files involved
--------------
- ``views/website_sale_disable_cart.xml`` — templates that hide/remove cart UI
- ``controllers/website_sale.py`` — routes that redirect cart endpoints to ``/eskaera``
- ``__manifest__.py`` — includes the new view file
How to apply or revert
-----------------------
To apply the change (already applied when the module is installed/updated):
::
docker-compose run --rm odoo odoo -d odoo -u website_sale_aplicoop --stop-after-init
docker-compose up -d
To revert back to the standard ``website_sale`` behaviour:
1. Remove ``views/website_sale_disable_cart.xml`` from the ``data`` section in
``__manifest__.py``.
2. Update the module:
::
docker-compose run --rm odoo odoo -d odoo -u website_sale_aplicoop --stop-after-init
Note: Reverting may expose standard cart UI and routes; ensure your site
content and workflows are adapted accordingly.

View file

@ -6,11 +6,34 @@
Convert /shop to a simple product catalog Convert /shop to a simple product catalog
========================================== --> ========================================== -->
<!-- Hide the cart link from the header --> <!-- Hide the cart link from the header by removing the t-call to website_sale.header_cart_link
<template id="header_cart_link_hidden" inherit_id="website_sale.header_cart_link" name="Hide Cart Link"> from the various header templates (more robust than targeting the cart template internals) -->
<xpath expr="//li[hasclass('o_wsale_my_cart')]" position="attributes"> <template id="hide_cart_in_header_default" inherit_id="website.template_header_default" name="Hide Cart Link in Header Default">
<attribute name="class" add="d-none" separator=" "/> <xpath expr="//t[@t-call='website_sale.header_cart_link']" position="replace"/>
</xpath> </template>
<template id="hide_cart_in_header_mobile" inherit_id="website.template_header_mobile" name="Hide Cart Link in Header Mobile">
<xpath expr="//t[@t-call='website_sale.header_cart_link']" position="replace"/>
</template>
<template id="hide_cart_in_header_hamburger" inherit_id="website.template_header_hamburger" name="Hide Cart Link in Header Hamburger">
<xpath expr="//t[@t-call='website_sale.header_cart_link']" position="replace"/>
</template>
<template id="hide_cart_in_header_stretch" inherit_id="website.template_header_stretch" name="Hide Cart Link in Header Stretch">
<xpath expr="//t[@t-call='website_sale.header_cart_link']" position="replace"/>
</template>
<template id="hide_cart_in_header_vertical" inherit_id="website.template_header_vertical" name="Hide Cart Link in Header Vertical">
<xpath expr="//t[@t-call='website_sale.header_cart_link']" position="replace"/>
</template>
<template id="hide_cart_in_header_search" inherit_id="website.template_header_search" name="Hide Cart Link in Header Search">
<xpath expr="//t[@t-call='website_sale.header_cart_link']" position="replace"/>
</template>
<template id="hide_cart_in_header_sales_one" inherit_id="website.template_header_sales_one" name="Hide Cart Link in Header Sales One">
<xpath expr="//t[@t-call='website_sale.header_cart_link']" position="replace"/>
</template> </template>
<!-- Remove "Add to Cart" button from product items in the shop --> <!-- Remove "Add to Cart" button from product items in the shop -->