[16.0][ADD]SCB: add custom overrides for supercoop bremen#147
[16.0][ADD]SCB: add custom overrides for supercoop bremen#147dockay wants to merge 1 commit intocoopiteasy:16.0from
Conversation
remytms
left a comment
There was a problem hiding this comment.
Here is some comment to improve your module. :) Have fun.
| <xpath expr="//t[@t-call='cooperator_website.main_form_template']" position="replace"> | ||
| <t t-call="cooperator_website.main_form_template"> | ||
|
|
||
| <!-- Mitgliedschaft ermitteln --> | ||
| <t t-set="user" t-value="request.env.user"/> | ||
| <t t-set="is_public" t-value="user._is_public()"/> | ||
| <t t-set="partner" t-value="(not is_public) and user.partner_id or False"/> | ||
| <!-- HINWEIS: Falls das Feld anders heißt (z.B. is_cooperator), hier anpassen --> | ||
| <t t-set="is_member" t-value="partner and partner.cooperator or False"/> | ||
|
|
||
| <!-- Titel je nach Status --> | ||
| <t t-if="is_member"> | ||
| <t t-set="title">Zusätzliche Anteile erwerben</t> | ||
| </t> | ||
| <t t-else=""> | ||
| <t t-set="title">Der Genossenschaft beitreten</t> | ||
| </t> | ||
|
|
||
| <!-- Hinweis für bereits eingeloggt + Mitglied --> | ||
| <t t-if="is_member"> | ||
| <div class="alert alert-info d-flex align-items-center mb-3" role="alert"> | ||
| <i class="fa fa-check-circle me-2"/> | ||
| <span>Du bist bereits Mitglied bei SUPERCOOP Bremen. Du kannst unten direkt zusätzliche Anteile zeichnen.</span> | ||
| </div> | ||
| </t> | ||
|
|
||
| <!-- Login/Bestätigungsmail-Blöcke --> | ||
| <div class="mb-3 field-login"> | ||
| <label for="email" class="form-label">Email</label> | ||
| <input class="form-control form-control-sm" | ||
| t-attf-class="form-control form-control-sm{{ error and 'email' in error and ' is-invalid' or '' }}" | ||
| autocapitalize="off" type="email" name="email" id="email" required="true" | ||
| t-att-readonly="logged" t-att-value="email" | ||
| placeholder="kontakt@supercoop-bremen.de"/> | ||
| </div> | ||
|
|
||
| <div t-if="not logged" class="mb-3 field-confirm_login" name="confirm_email_container"> | ||
| <label for="confirm_email" class="form-label">Confirm Email</label> | ||
| <input t-attf-class="form-control form-control-sm{{ error and 'confirm_email' in error and ' is-invalid' or '' }}" | ||
| autocapitalize="off" type="email" name="confirm_email" id="confirm_email" required="true" | ||
| t-att-readonly="logged" t-att-value="confirm_email" | ||
| placeholder="kontakt@supercoop-bremen.de"/> | ||
| </div> | ||
|
|
||
| <!-- Rest bleibt wie im Original --> | ||
| <t t-call="cooperator_website.contact_template"/> | ||
| <t t-call="cooperator_website.iban_template"/> | ||
| <t t-call="cooperator_website.address_template"/> | ||
| <t t-call="cooperator_website.shares_template"/> | ||
| <t t-call="cooperator_website.rules_template"/> | ||
|
|
||
| </t> | ||
| </xpath> |
There was a problem hiding this comment.
Do not use such a position="replace", it will break at some point and there is a lot of copy-paste code. That’s not the spirit of extending templates in Odoo.
In the same template, create several xpath entry, one for each modification. Target a tag and use position="before", position="after" or position="inside" to add your element.
E.g.:
<xpath expr="//div[hasclass('field-login')]" position="before">
<!-- Mitgliedschaft ermitteln -->
<t t-set="user" t-value="request.env.user"/>
<t t-set="is_public" t-value="user._is_public()"/>
<t t-set="partner" t-value="(not is_public) and user.partner_id or False"/>
<!-- HINWEIS: Falls das Feld anders heißt (z.B. is_cooperator), hier anpassen -->
<t t-set="is_member" t-value="partner and partner.cooperator or False"/>
<!-- Titel je nach Status -->
<t t-if="is_member">
<t t-set="title">Zusätzliche Anteile erwerben</t>
</t>
<t t-else="">
<t t-set="title">Der Genossenschaft beitreten</t>
</t>
<!-- Hinweis für bereits eingeloggt + Mitglied -->
<t t-if="is_member">
<div class="alert alert-info d-flex align-items-center mb-3" role="alert">
<i class="fa fa-check-circle me-2"/>
<span>Du bist bereits Mitglied bei SUPERCOOP Bremen. Du kannst unten direkt zusätzliche Anteile zeichnen.</span>
</div>
</t>
</xpath>
Also, please, use english for text. Then translate using `.po` files.| @@ -0,0 +1,68 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <odoo> | |||
| <data noupdate="0"> | |||
There was a problem hiding this comment.
data tag is not used anymore in 16.0. noupdate=0 is the default value and can be put in the odoo tag.
| <!-- Navbar-Anpassungen für SUPERCOOP Bremen --> | ||
| <template id="supercoop_navbar_inherit" | ||
| name="SUPERCOOP Navbar" | ||
| inherit_id="website.navbar"> | ||
|
|
||
| <!-- 1) Nav-Element leicht anpassen (shadow, etc.) --> | ||
| <xpath expr="//nav[@data-name='Navbar']" position="attributes"> | ||
| <!-- bestehende Klassen erweitern, nicht ersetzen --> | ||
| <attribute name="class" add=" shadow-sm" separator=" "/> | ||
| </xpath> | ||
|
|
||
| <!-- 2) Container: flex-Layout sicherstellen --> | ||
| <xpath expr="//div[@id='top_menu_container']" position="attributes"> | ||
| <attribute name="class"> | ||
| container d-flex align-items-center justify-content-start justify-content-lg-between | ||
| </attribute> | ||
| </xpath> | ||
|
|
||
| <!-- 3) Top-Menü-UL pilliger machen --> | ||
| <xpath expr="//ul[@id='top_menu']" position="attributes"> | ||
| <attribute name="class"> | ||
| nav navbar-nav flex-grow-1 nav-pills gap-3 | ||
| </attribute> | ||
| <attribute name="role">menu</attribute> | ||
| </xpath> | ||
|
|
||
| <!-- 4) Struktur-Slot rechts vom Menü (falls noch nicht vorhanden) --> | ||
| <xpath expr="//div[@id='top_menu_collapse']" position="after"> | ||
| <div class="oe_structure oe_structure_solo ms-lg-4"/> | ||
| </xpath> | ||
|
|
||
| </template> |
| "license": "LGPL-3", | ||
| "depends": [ | ||
| "website", | ||
| "portal", |
There was a problem hiding this comment.
Why "portal" module is a dependency of this module ?
| @@ -0,0 +1 @@ | |||
| # -*- coding: utf-8 -*- | |||
There was a problem hiding this comment.
Since python 3 this header is not needed in files as all files must be utf-8. To remove in all files.
Instead use header like this:
# SPDX-FileCopyrightText: 2017 Open Architects Consulting SPRL
# SPDX-FileCopyrightText: 2018 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later
Edit to conform you copyright holder.
| </template> | ||
|
|
||
| </data> | ||
| </odoo> |
There was a problem hiding this comment.
I’m not sure about this template. I don’t find website.user_menu template in the source code. I think this is a generated views for the website. So it may be modified directly in the database.
Also using replace is not good.
|
Thanks @remytms, I was on vacation and yesterday we had our general assembly meeting and they voted Claire out, so I'm resigning too from the IT for the supercoop. I don't know who will take my place so just you know that it will take some time. |
Description
SUPERCOOP Bremen – Website & Cooperator Page Improvements
This PR introduces a set of safe, update-proof website overrides for SUPERCOOP Bremen.
All modifications follow Odoo best practices using XPath inheritance only (no full template replacement), as requested in the previous review.
The added module:
contains three main improvements:
1. Become Cooperator Page (
cooperator_website.becomecooperator)We added logic to enhance the user experience for members vs. non-members.
✔ Member detection
is_public,partner, andis_memberare computed usingrequest.env.user.✔ Dynamic page title
If the user is already a member:
→ Title becomes “Zusätzliche Anteile erwerben” (“Purchase additional shares”).
If the user is not a member:
→ Title becomes “Der Genossenschaft beitreten” (“Join the cooperative”).
✔ Member information banner
Members now see an informational banner:
✔ Email / Confirm Email behavior
The Confirm Email field is displayed only when
not logged, matching the original behavior.All modifications are injected inside the existing
cooperator_website.main_form_templateblock using a precise XPathreplace.No original Coopiteasy templates are overwritten.
2. Navbar Adjustments (
website.navbar)Styling and structure of the navbar were improved:
shadow-smto the navbar.#top_menuclasses to:oe_structureblock on the right side of the navbar.All changes use safe XPath inheritance and avoid modifying the original template directly.
3. User Menu Adjustments (
website.user_menu)To avoid user-name flickering on portal pages and ensure a more consistent UX:
/my/home)/my/shift)This prevents portal caching issues where random partner names were appearing in the header.
Summary
If you'd like adjustments or want the overrides split across multiple modules, we’re happy to update the PR.
Odoo task (if applicable)
Checklist before approval