Skip to content

[16.0][ADD]SCB: add custom overrides for supercoop bremen#147

Open
dockay wants to merge 1 commit intocoopiteasy:16.0from
dockay:16.0-scb-custom-overrides
Open

[16.0][ADD]SCB: add custom overrides for supercoop bremen#147
dockay wants to merge 1 commit intocoopiteasy:16.0from
dockay:16.0-scb-custom-overrides

Conversation

@dockay
Copy link
Copy Markdown

@dockay dockay commented Nov 18, 2025

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:

scb_custom

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, and is_member are computed using request.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:

“You are already a member of SUPERCOOP Bremen. You can directly purchase additional shares below.”

✔ 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_template block using a precise XPath replace.
No original Coopiteasy templates are overwritten.


2. Navbar Adjustments (website.navbar)

Styling and structure of the navbar were improved:

  • Added shadow-sm to the navbar.
  • Ensured proper flex alignment of the container.
  • Updated #top_menu classes to:
    nav navbar-nav flex-grow-1 nav-pills gap-3
    
  • Added an oe_structure block 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:

  • Replaced the username display in the header with a static label “Mein Konto” (“My Account”).
  • The dropdown now contains:
    • My Account (/my/home)
    • My Shifts (/my/shift)
    • Logout
  • Public users continue to see “Anmelden” (“Login”).

This prevents portal caching issues where random partner names were appearing in the header.


Summary

  • All changes are additive, done via XPath, and follow Odoo/Coopiteasy best practices.
  • No core templates are removed or overridden.
  • The PR improves membership signup UX and stabilizes website header behavior.
  • The module is fully upgrade-safe and ready for production.

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

  • Tests are present (or not needed).
  • Credits/copyright have been changed correctly.
  • Change log snippet is present.
  • (If a new module) Moving this to OCA has been considered.

@dockay dockay changed the title SCB: add custom overrides for supercoop bremen [16.0][ADD]SCB: add custom overrides for supercoop bremen Nov 18, 2025
Copy link
Copy Markdown
Member

@remytms remytms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is some comment to improve your module. :) Have fun.

Comment on lines +11 to +63
<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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data tag is not used anymore in 16.0. noupdate=0 is the default value and can be put in the odoo tag.

Comment on lines +5 to +36
<!-- 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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job here. :)

"license": "LGPL-3",
"depends": [
"website",
"portal",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "portal" module is a dependency of this module ?

Comment thread scb_custom/__init__.py
@@ -0,0 +1 @@
# -*- coding: utf-8 -*-
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dockay
Copy link
Copy Markdown
Author

dockay commented Apr 11, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants