addons-cm/website_sale_aplicoop/readme/CONFIGURE.rst
GitHub Copilot e625b0c2f3 [IMP] website_sale_aplicoop: pay on the checkout page, not a step later
The separate /eskaera/<slug>/payment step is gone. Members review the
summary, choose home delivery and pick a payment method on the checkout,
in one screen; the old URL redirects there so bookmarks and sessions that
were mid-flow do not hit a 404.

The checkout now renders the member's draft sale.order instead of the
localStorage cart. That is what fixes the products appearing "out of
nowhere" between the two pages: the summary was a snapshot of localStorage
taken at page load, and `_autoLoadDraftOnInit` then pulled the draft back
into localStorage without re-rendering. Deleting a product in the shop
removed it from the cart but left the line on the draft, so the autoload
resurrected it, the confirm button sent it back, and it only became
visible one page later. The checkout no longer auto-loads the draft — it
renders it, and what it shows is what the payment form charges.

"Proceed to Checkout" pushes the cart to that draft before navigating.
Saving is idempotent: `_merge_or_replace_draft` reuses the cycle's draft
and, through the new `_draft_matches_lines`, rewrites `order_line` only
when the lines actually differ — replacing them unlinks and recreates
every one of them, which is pure churn when nothing changed.

The home delivery checkbox goes through the new /eskaera/set-home-delivery
so the delivery line moves on the order itself. Writing only to
localStorage would have changed the summary and left the amount alone,
which with online payment on is the amount being charged.

Also fixes the confirmation notice nobody ever saw: saving answered with
the payment step URL and the frontend followed it immediately, destroying
the toast in the same tick. Saving no longer navigates; the caller decides
whether it is staying or moving on.

Along the way: checkout_labels.js and the eskaera_checkout_summary /
eskaera_payment templates are removed, superseded by the server-rendered
summary and checkout, and the stale sessionStorage delivery preference no
longer overrides the checkbox the order just rendered.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-17 19:14:49 +02:00

82 lines
3.5 KiB
ReStructuredText

To configure this module, you need to:
**Lazy Loading Configuration (v18.0.1.3.0+):**
#. Go to Settings → Website → Shop Performance
#. Enable "Enable Lazy Loading" checkbox
#. Set "Products Per Page" (default: 20)
#. Save settings
**Global Settings:**
#. Go to Settings → Website → Shop Settings
#. Configure default group settings
#. Define pickup days and locations
**Group Management:**
#. Go to Contacts, filter by Groups (is_group=True)
#. Create groups for your cooperative communities
#. Add partners/members to groups via the Members tab
**Product Configuration:**
#. 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.
**Online payment (v18.0.1.14.0+):**
Payment is enabled per group order, and off by default: an order without it
behaves exactly as before, with members saving a draft that the cutoff cron
confirms in bulk.
#. Configure the providers first, where Odoo always keeps them:
Settings → Payment Providers. Enable and publish at least one (bank
transfer, Redsys, Stripe...). This module ships no provider of its own and
configures none; it only shows whichever ones are compatible.
#. On a multi-website database, leave a provider's *Website* field empty to
offer it everywhere, or set it to restrict the provider to one site.
#. Open the group order form → *Online Payment* tab → tick **Online payment**.
With the flag on, paying is the only way to place an order: the payment
methods appear on ``/eskaera/<slug>/checkout``, next to the order summary, and
the member's sale order is confirmed as soon as the transaction completes.
There is no separate payment step — the old ``/eskaera/<slug>/payment`` URL
redirects to the checkout. Members who have not paid by the cutoff
date still get their draft confirmed by the cron, exactly as they do today —
the flag decides how orders are placed, not who gets served.