Members can now pay their eskaera at checkout, through the standard Odoo payment machinery. Enabled per group order with a new `online_payment` boolean, off by default: an order without it behaves exactly as before, members save a draft and the cutoff cron confirms them in bulk. The flow mirrors website_sale's: the checkout button becomes "Confirm and pay", saving the cart redirects to a new /eskaera/<slug>/payment step that renders `payment.form` from `sale`'s `_get_payment_values`, and the standard /my/orders/<id>/transaction route takes it from there. This addon ships no provider and configures none; the co-op publishes whichever it wants. `website_sale`'s `_get_shop_payment_values` is deliberately not reused: it runs `_get_shop_payment_errors`, which blocks on shippable products without a delivery method — exactly an eskaera order, collected at the co-op with no carrier. For the same reason the transaction route stays the portal one, which does not call `_check_cart_is_ready_to_be_paid()`. Payment confirms the order, which has three consequences handled here: * `payment.transaction._check_amount_and_confirm_order` now confirms group orders with `from_orderpoint=True`, the way the cutoff cron already does. Without it a product with a broken replenishment route raises inside `_post_process`, and `/payment/status/poll` rolls back and re-raises: the member sees a payment error over a `done` transaction and the retry cron fails forever. * `_confirm_linked_sale_orders` also sweeps the cycle's already confirmed orders into the picking batch, scoped by `pickup_date`. Its early return on "no drafts" ran before any batching, so a fully prepaid cycle produced no batch at all. `_cron_batch_paid_orders_of_closed_cycles` covers the same hole for cycles closed by hand. * A duplicate-order guard answers 409 on save-order, add-to-cart and load-draft, and shows a notice on the shop, so a member whose order is already placed cannot build and pay for a second one. The payment policy lives in the model rather than the controller: there are three sale.order creation paths and two are live, so `_compute_require_payment` and `_compute_prepayment_percent` are extended instead of patching five vals dicts. Orders are also created under the group order's company, which is what filters the payment providers. Along the way: eskaera drafts were invisible in /my/orders. The portal rule is `message_partner_ids child_of` and sale.order only subscribes the customer on send or confirm, never on a draft create, so the `_prepare_orders_domain` override that includes drafts never had any effect. Fixed with an explicit `message_subscribe`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
81 lines
3.4 KiB
ReStructuredText
81 lines
3.4 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, the checkout button becomes "Confirm and pay" and paying is
|
|
the only way to place an order: the member goes through
|
|
``/eskaera/<slug>/payment``, picks a method, and their sale order is confirmed
|
|
as soon as the transaction completes. 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.
|