[IMP] website_sale_aplicoop: readable slug in the group order URL
Group order pages were published under their database id (`/eskaera/1`), which says nothing to the member opening the link. `group.order` gains a `slug` field and the public pages move to `/eskaera/<slug>` (e.g. `/eskaera/escola-fructuos`). The slug is generated from the order name on creation, is unique, and can be edited under the name on the form; emptying it regenerates it from the current name. Values that would make the order unreachable are rejected: a plain number (the legacy numeric URLs win that match) and the static routes served under `/eskaera/` (`labels`, `save-order`, `i18n`, ...). `/eskaera/<id>` and `/eskaera/<id>/checkout` are kept as redirects to their slug URL, so the links already shared with members keep working. The AJAX endpoints (`load-page`, `save-order`, `confirm`, ...) stay numeric: they never show up in the address bar. Consequently the frontend now reads the order id from the `data-order-id` attribute only, as the URL no longer carries it. The post-migration script fills the slug of the orders that already existed. Renaming the `/eskaera` prefix itself (`/escolas` for a schools deployment) needs no code: a *308 Redirect / Rewrite* rule per public route in Website > Configuration > Redirects serves the pages on the new prefix, rewrites the links in the templates and redirects the old URLs, per website. Documented in `readme/CONFIGURE.rst`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
2b1cabbb43
commit
23edee6154
14 changed files with 463 additions and 28 deletions
|
|
@ -24,3 +24,37 @@ To configure this module, you need to:
|
|||
#. Link products to categories used in group orders
|
||||
#. Configure pricing and taxes for products
|
||||
#. Set product availability per supplier
|
||||
|
||||
**Public URL of a group order (v18.0.1.13.0+):**
|
||||
|
||||
Every group order is published under a readable slug, ``/eskaera/<slug>``
|
||||
(for example ``/eskaera/escola-fructuos``), instead of its database id.
|
||||
|
||||
#. Open the group order form: the slug is shown right under the name
|
||||
#. Leave it as generated or type your own (lowercase, digits and hyphens)
|
||||
#. Empty it and save to generate it again from the current name
|
||||
#. Old ``/eskaera/<id>`` links keep working: they redirect to the slug URL
|
||||
|
||||
Changing the slug of an order that members already bookmarked breaks those
|
||||
links, so pick it before publishing the order.
|
||||
|
||||
**Renaming the /eskaera prefix per website:**
|
||||
|
||||
The prefix can be changed without touching the code, per website, with
|
||||
Odoo's own rewrite rules — useful when the site does not speak Basque
|
||||
(``/escolas``, ``/pedidos``…):
|
||||
|
||||
#. Go to Website → Configuration → Redirects and click New
|
||||
#. Choose the action **308 Redirect / Rewrite** and the website to apply it to
|
||||
#. Add one rule per public page, keeping the parameter untouched:
|
||||
|
||||
* ``/eskaera`` → ``/escolas``
|
||||
* ``/eskaera/<string:group_order_slug>`` → ``/escolas/<string:group_order_slug>``
|
||||
* ``/eskaera/<string:group_order_slug>/checkout`` → ``/escolas/<string:group_order_slug>/checkout``
|
||||
|
||||
#. Update the URL of the website menu (Website → Site → Content → Menus)
|
||||
|
||||
Odoo then serves the pages on the new prefix, rewrites the links in the
|
||||
templates and redirects the old URLs. The AJAX endpoints
|
||||
(``/eskaera/labels``, ``/eskaera/save-order``…) are never shown in the
|
||||
address bar and do not need a rule.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue