addons-cm/website_sale_aplicoop/readme/USAGE.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

65 lines
2.3 KiB
ReStructuredText

**Administrator Workflow:**
Creating a Group Order
~~~~~~~~~~~~~~~~~~~~~~
#. Go to Website Sale → Group Orders (or Coops → Órdenes de Grupo)
#. Click Create
#. Fill in:
* **Name**: e.g., "Weekly Cooperative Order #5"
* **Group**: Select the cooperative group
* **Collection Date**: When orders will be collected
* **Cutoff Date**: Last moment to add items
* **Pickup Date**: When group members collect their orders
#. Add members in the Members tab
#. Set member status (active/inactive)
#. Save and transition to appropriate state
Managing Pickup Dates
~~~~~~~~~~~~~~~~~~~~~
#. Go to Settings → Website → Shop Settings
#. Configure Pickup Days (define available days)
#. Set Group Settings (default locations, delivery partners)
**Customer Workflow:**
For Group Members on Website
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#. **Browse Products**: See products with eco-ribbons, pricing, margin info
#. **Add to Cart**: Select items (cart is separate per group order)
#. **Review Cart**: Check order summary before cutoff date
#. **Submit Order**: Confirm before cutoff time
#. **Receive Notification**: Get email with pickup details
#. **Pickup**: Collect order on designated pickup date
Order States
~~~~~~~~~~~
* **Draft**: Order being prepared
* **Confirmed**: Order open for shopping
* **Collected**: Orders received from supplier
* **Completed**: All members have picked up their orders
Paying an order online
~~~~~~~~~~~~~~~~~~~~~~
When the group order has online payment enabled:
#. Build the cart in ``/eskaera/<slug>`` as usual
#. Press **Proceed to Checkout**: the cart is saved to your order first, so
the checkout shows the very lines and amounts that will be charged
#. Review the summary, choose home delivery if offered, and pick a payment
method — all on the same page
#. Press **Confirm and pay**; you are sent to the provider and back
#. The confirmation page shows the outcome and empties the local cart
The order is confirmed the moment the payment goes through, so it can no
longer be edited. Coming back to the shop shows a notice with a link to the
order instead of an empty cart, so nobody pays twice for the same cycle.
If the payment is still being processed when you come back, the page says so
and the order is confirmed as soon as the provider settles it.