[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:
GitHub Copilot 2026-08-11 16:49:54 +02:00
parent 2b1cabbb43
commit 23edee6154
14 changed files with 463 additions and 28 deletions

View file

@ -11,6 +11,7 @@
<field name="sequence" widget="handle"/>
<field name="company_id" optional="hide"/>
<field name="name"/>
<field name="slug" optional="hide"/>
<field name="group_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
<field name="type" optional="show"/>
<field name="start_date" optional="show"/>
@ -45,6 +46,10 @@
<h1>
<field name="name" placeholder="Order Name"/>
</h1>
<div class="text-muted d-flex align-items-center">
<span class="me-1">/eskaera/</span>
<field name="slug" placeholder="weekly-order" class="oe_inline" help="Readable identifier used in the public URL of this order. Empty it to generate it again from the name; changing it breaks the links already shared with members."/>
</div>
</div>
</div>
</div>
@ -116,6 +121,7 @@
<field name="arch" type="xml">
<search string="Group Orders">
<field name="name"/>
<field name="slug"/>
<field name="group_ids"/>
<field name="type"/>
<field name="state"/>