[ADD] website_sale_disable_cart: extract cart restriction from website_sale_aplicoop
The "shop as a read-only catalog" behaviour lived inside website_sale_aplicoop, so every site that wanted the eskaera flow also lost the standard cart. It now ships as its own installable addon, with the redirect target configurable instead of hardcoded to /eskaera. - website_sale_disable_cart: hides the cart UI (12 header styles + the product card quick-add) and overrides the standard cart endpoints. Redirect URL is configurable in Website settings (default /shop); only site-internal paths are accepted, so a misconfigured value cannot turn the shop into an open redirect nor loop back into a disabled route. - Fixes carried over from the original code: /shop/cart/quantity is the Odoo 18 path (it was /shop/cart_quantity, which never matched), the boxed, sidebar and sales two/three/four headers were not covered (the cart link stayed visible on them), and the routes now override the standard methods instead of registering duplicate ones. - website_sale_aplicoop 18.0.1.12.0: drops the view file and the four redirect routes; installing it no longer touches the standard shop. Upgrade order matters: update website_sale_aplicoop first, then install website_sale_disable_cart in a second Odoo run — both use the same XPaths and obsolete records are only cleaned up at the end of a run. Tests: 8/8 in website_sale_disable_cart, aplicoop unaffected (its 2 failures predate this change). Verified live on a DB clone: /shop/cart returns 303 to the configured URL and no cart markup remains on /shop. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
73660ee226
commit
f2194c5367
28 changed files with 733 additions and 91 deletions
|
|
@ -142,48 +142,22 @@ This module was inspired by the original **Aplicoop** project:
|
|||
|
||||
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
|
||||
=========================================
|
||||
Notes - Standard shop and cart
|
||||
==============================
|
||||
|
||||
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.
|
||||
This module adds the "eskaera" group order flow (``/eskaera``); it no longer
|
||||
touches the standard ``website_sale`` storefront. The default ``/shop`` and its
|
||||
shopping cart keep working as usual after installing it.
|
||||
|
||||
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):
|
||||
Sites that want the standard cart disabled — so that the group order flow is
|
||||
the single shopping experience — should additionally install
|
||||
``website_sale_disable_cart``, which hides the cart UI and redirects the
|
||||
standard cart endpoints to a configurable URL. That behaviour used to live in
|
||||
this module (up to 18.0.1.11.0) and was extracted in 18.0.1.12.0.
|
||||
|
||||
::
|
||||
|
||||
docker-compose run --rm odoo odoo -d odoo -u website_sale_aplicoop --stop-after-init
|
||||
docker-compose up -d
|
||||
docker-compose run --rm odoo odoo -d odoo -i website_sale_disable_cart --stop-after-init
|
||||
|
||||
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.
|
||||
Then set *Website > Configuration > Settings > Disabled Cart > Cart Redirect
|
||||
URL* to ``/eskaera``.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue