Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scb_custom/__init__.py
Original file line number Diff line number Diff line change
@@ -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.

23 changes: 23 additions & 0 deletions scb_custom/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
{
"name": "SUPERCOOP Bremen Website Overrides",
"summary": "Navbar-, User-Menü- und Become-Cooperator-Anpassungen für SUPERCOOP Bremen",
"version": "16.0.1.0.0",
"author": "SUPERCOOP Bremen eG",
"website": "https://supercoop-bremen.de",
"category": "Website",
"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 ?

"cooperator_website",
],
"data": [
"views/website_navbar.xml",
"views/website_user_menu.xml",
"views/website_become_cooperator.xml",
],
"assets": {},
"installable": True,
"application": False,
}
68 changes: 68 additions & 0 deletions scb_custom/views/website_become_cooperator.xml
Original file line number Diff line number Diff line change
@@ -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.


<!-- Become-Cooperator Seite: SUPERCOOP-spezifische Logik für Mitglieder vs. Nicht-Mitglieder -->
<template id="supercoop_become_cooperator_inherit"
name="SUPERCOOP Become Cooperator"
inherit_id="cooperator_website.becomecooperator">

<!-- Ersetze nur den Block, der main_form_template aufruft, um eigene Logik einzufügen -->
<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>
Comment on lines +11 to +63

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.


</template>

</data>
</odoo>
39 changes: 39 additions & 0 deletions scb_custom/views/website_navbar.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">

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

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. :)


</data>
</odoo>
53 changes: 53 additions & 0 deletions scb_custom/views/website_user_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">

<!-- User-Menü Override: keine Namen mehr, nur "Mein Konto" -->
<template id="supercoop_website_user_menu"
name="SUPERCOOP User Menu Override"
inherit_id="website.user_menu">

<!-- Public-Teil ersetzen -->
<xpath expr="//t[@t-if='request.env.user._is_public()']" position="replace">
<t t-if="request.env.user._is_public()">
<ul class="navbar-nav ms-lg-auto">
<li class="nav-item">
<a class="nav-link" href="/web/login">Anmelden</a>
</li>
</ul>
</t>
</xpath>

<!-- Eingeloggt-Teil ersetzen -->
<xpath expr="//t[@t-else='']" position="replace">
<t t-else="">
<ul class="navbar-nav ms-lg-auto">
<li class="nav-item dropdown o_no_autohide_item">
<a href="#" role="button"
data-bs-toggle="dropdown"
class="dropdown-toggle nav-link fw-bold">
<i class="fa fa-user-circle-o me-1"/>
<span>Mein Konto</span>
</a>
<div role="menu" class="dropdown-menu js_usermenu">
<a href="/my/home" role="menuitem" class="dropdown-item ps-3">
<i class="fa fa-fw fa-id-card-o me-1 small text-muted"/> Mein Konto
</a>
<a href="/my/shift" role="menuitem" class="dropdown-item">
Meine Schichten
</a>
<div class="dropdown-divider"/>
<a id="o_logout" role="menuitem" class="dropdown-item ps-3"
href="/web/session/logout?redirect=/">
<i class="fa fa-fw fa-sign-out me-1 small text-muted"/> Abmelden
</a>
</div>
</li>
</ul>
</t>
</xpath>

</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.