Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing-
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

Inherit a line in Qweb view to add groups="user.group"

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
QwebInherit
1 Antworten
101 Ansichten
Avatar
Anton

How can I inherit these views to add groups="base.group_portal,base.group_user"?


0
Avatar
Verwerfen
Codesphere Tech

Hello,
Can you tell the exact place where you want to add groups?

Anton
Autor

@Codesphere Tech

The highlighted.

<t t-set="product_variant_id" t-value="product._get_first_possible_variant_id()"/>
and
<form t-if="product._is_add_to_cart_possible()">

Codesphere Tech

Hello
<xpath expr="//form[@t-if='product._is_add_to_cart_possible()']" position="attributes">
<attribute name="groups">base.group_portal,base.group_user</attribute>
</xpath>

Hope it helps to you.
I didn't find second view in Odoo 18..
Thanks.

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Beste Antwort
Hi,

To inherit a Qweb view in Odoo and add a groups attribute to a specific element, you need to create a custom module with an XML file. This XML file will contain an ir.ui.view record that inherits from the target Qweb template, such as website_sale.product. The inheritance is defined using the inherit_id attribute, pointing to the external ID of the original view.

Within this inheritance template, an xpath expression is used to precisely locate the HTML element you wish to modify. The position="attributes" directive is crucial here, as it tells Odoo to modify the attributes of the found element rather than its content. Subsequently, an <attribute name="groups"> tag is used to assign the desired group IDs (e.g., base.group_portal,base.group_user) to the element, thereby controlling its visibility based on user access rights.

Sample code:

<odoo>
    <data>
        <template id="my_custom_product_qweb_inherit" inherit_id="website_sale.product" name="Product Page Qweb Inheritance - Add Groups">
            <xpath expr="//div[hasclass('oe_product_price')]" position="attributes">
                <attribute name="groups">base.group_portal,base.group_user</attribute>
            </xpath>

            <!-- If you want to target a specific element by ID, for instance: -->
            <!-- <xpath expr="//div[@id='product_description_short']" position="attributes">
                <attribute name="groups">base.group_portal,base.group_user</attribute>
            </xpath> -->

            <!-- If you want to add a new element with groups, you would use 'after' or 'before' position and define the new element -->
            <!-- <xpath expr="//div[hasclass('oe_product_price')]" position="after">
                <div groups="base.group_portal,base.group_user">
                    <p>This content is only visible to portal and internal users.</p>
                </div>
            </xpath> -->
        </template>
    </data>
</odoo>
Finally, ensure your custom module's __manifest__.py file includes this new XML file in its data list and that the module depends on website_sale. After these changes, upgrading your custom module in Odoo will apply the inheritance, making the specified element visible only to users belonging to the defined groups.


Hope it helps

0
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
Qweb report not printing in Go4Hosting server
Qweb
Avatar
Avatar
Avatar
2
März 16
4324
JSON code displayed instead of table
report Qweb
Avatar
Avatar
1
Aug. 23
2506
Border-image in qweb-pdf Odoo 13
qweb-css Qweb
Avatar
Avatar
1
März 24
5720
How to use hover in the menu drop down list in website using qweb? Gelöst
Qweb hover
Avatar
Avatar
1
Sept. 21
10889
How to show or call a record list from another module for dropdown view in website page portal.
Qweb Odoo13.0
Avatar
0
Apr. 20
4362
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now