Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

How to use groups policies in qweb templates?

Naroči se

Get notified when there's activity on this post

This question has been flagged
securityv8qwebgroups
1 Odgovori
18315 Prikazi
Avatar
Alejandro Santana

When extending a qweb template in v8, is it possible to add the groups policies to elements as in views*? How?
(*) Adding groups="my_module.my_security_group"

I have tried to hide the im_chat button at the top and show it only to some managers group, but it doesn't work as expected and has no result. The code:

<?xml version="1.0" encoding="UTF-8"?>

<templates xml:space="preserve">
<t t-extend="im_chat.ImTopButton">
    <t t-jquery="li" t-operation="replace">
        <li t-att-title='_t("Display Instant Messaging")' groups="my_module.group_my_module_manager">
            <a href="#">
                  <i id="oe_topbar_imbutton_icon" class="fa fa-comments-o"/>
            </a>
        </li>
    </t>
</t>
</templates>

I have also tried to specify the groups policy through t-field-options, with no luck.

<li t-att-title='_t("Display Instant Messaging")' t-field-options='{"groups": "crm_ticket_platforms.group_crm_ticket_platforms_manager"}'>

UPDATE:

Reading more, I have tried using tag "t-att-groups", as explained in official documentation (a-att-$name), but without result. As that expression is documented and supposed to work, I have opened an issue in Github: https://github.com/odoo/odoo/issues/5058 

Let's see how it ends.

 

UPDATE 2:

With some comments on issue https://github.com/odoo/odoo/issues/5058 it is clear I was missunderstanding the purpose of qweb t-att-$name attributes. It is intended for html attributes only (width, href, etc.), not for Odoo meta-data as group security policy.

It is stated I could use t-if, but haven't tested it yet. It surely uses some akward domain, as usual.

1
Avatar
Opusti
Avatar
Jérémy Kersten (jke)
Best Answer

Hello,

I'm not sure that  you can use groups in Qweb js.

Why not use the same code that in im_chat.js

    if (openerp.web && openerp.web.Model) {
        // Put the ImTopButton widget in the systray menu if the user is an employee
        var Users = new openerp.web.Model('res.users');
        Users.call('has_group', ['base.group_user']).done(function(is_employee) {
            if (is_employee) {
                openerp.web.SystrayItems.push(openerp.im_chat.ImTopButton);
            }
        });
    }

Good luck

2
Avatar
Opusti
Alejandro Santana
Avtor

Aaaaahhh... I just don't know a bit of javascript (yet). Is there any documentation on how to extend/override that in Odoo? I could change the group there, but I don't know how to use inheritance in Odoo js.

Jérémy Kersten (jke)

You can find a tuto here : https://www.odoo.com/documentation/8.0/howtos/web.html And Js documentation here : https://www.odoo.com/documentation/8.0/reference/javascript.html The simple way for you (not the more elegant way), will be to remove the button if not respected your conditions. The code from previous Answer is from master, take a look in im_chat from version 8.

Alejandro Santana
Avtor

I finally solved it as explained here: https://www.odoo.com/es_ES/forum/help-1/question/how-to-override-js-code-in-odoo-75335

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Is it correct to define a group as base.group_name in custom modules?
security v8 groups
Avatar
0
maj 16
5806
Get id of new Group Solved
security v8 buttons groups
Avatar
Avatar
2
jul. 15
7296
How to override JS code in Odoo? Solved
security v8 js groups
Avatar
Avatar
2
mar. 15
21763
QWEB: Place full width image on page Solved
v8 qweb
Avatar
Avatar
1
jun. 21
8706
How to write not in group ?
qweb groups
Avatar
Avatar
1
okt. 18
6823
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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