Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Can you apply a theme based on the user who logs in?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
layoutstylethemethemes
1 Respondre
6303 Vistes
Avatar
Darrel

We want to let clients sign in to our system and each see only the menu items, pages, and layout/theme that we have made for that particular client.

I've been following the theme tutorial here (http://odoo-80.readthedocs.org/en/latest/guides/themes.html) but I don't see how to choose the theme based on the user viewing the page. I'm still pretty new to Odoo. Any ideas?

Edit: I'm also trying to figure out how to apply a theme to specific areas (controllers or actions) of the odoo site. Any links to documentation or tutorials on this would be appreciated.

0
Avatar
Descartar
Luke Branch

@Darrel, I think you would need to build a custom theme and use a combination of t-if statements and group access rights to achieve what you require. Could you post back with details on exactly what you are trying to achieve with examples of what you'd like to achieve (eg. custom pages only viewable by certain user groups). This will make it easier for people to offer you advice on how you might be able to achieve your requirements.

OdooBot
sure, Luke.

I work for an ecommerce company, and we have two specific goals
requiring custom themes.

a) We want to let ecommerce clients log into Odoo and view reports on
our services, which are branded to that client. And b) We want
multiple separate layouts for the frontend website and product list,
based on the domain the website is being served from.

I think I can implement a new theme for the frontend, by having a
module with templates which inherit web.assets_backend,
website.assets_frontend and 'layout.' What I'm having trouble figuring
out is how (or if) I can make that CSS and HTML dependent on the user
viewing the page, for a, and the domain the site is being accessed
from, for b.

If it helps, we can ignore b) for now, since I am still quite new to
Odoo and the answer may become clear in time.

I would appreciate any help you can provide. There's still a lot I
don't understand about how the website module was able to create a
frontend and give it a separate layout like it has.

Darrel


On Thu, Dec 4, 2014 at 2:45 AM, Luke <luke-weairsoft-com@mail.odoo.com> wrote:
> @Darrel, I think you would need to build a custom theme and use a
> combination of t-if statements and group access rights to achieve what you
> require. Could you post back with details on exactly what you are trying to
> achieve with examples of what you'd like to achieve (eg. custom pages only
> viewable by certain user groups). This will make it easier for people to
> offer you advice on how you might be able to achieve your requirements.
>
> --
> Luke
> Sent by Odoo S.A. using Odoo about Forum Post Can you apply a theme based on
> the user who logs in?

>> I am trying to understand the mechanism behind how the website module
>> has a 'frontend' section which uses a different layout that the
>> regular admin area.

>> I thought I might see something in it's main.py controller class but
>> haven't found anything relevant yet.

>> For context, my two layout related goals are to a) apply a new layout
>> to a limited part of the website's frontend, and b) change that layout
>> depending on the user who is viewing the page (so, load a css file
>> specific to the user account).

>> Any tips, or links to documentation would be appreciated. I have gone
>> through this (http://odoo-80.readthedocs.org/en/latest/guides/themes.html)
>> but still don't see how to the actual areas covered by different
>> themes are controlled.
Avatar
Luke Branch
Best Answer

In regards to b) I believe what you are referring to is a multi-website type setup (similar to Magento's Website > Store > Store View architecture). Point b) is being worked on in version 9.0 (currently the master branch - runbot.odoo.com), however it is many months away from being released as a stable release. From what I understand version 9 will allow you to run multiple websites with different theme modules, different products, CMS pages, etc. from one database. Currently with Odoo 8.0 it is only really feasible to run one website with one set of CMS pages and products for the page.

While technically it is feasible to build some custom modules to achieve this type of functionality based on domain, etc. I think they would be hack methods/workarounds at best due to the fact the underlying architecture is not there to support it properly.

With that being said in regards to point a) you can certainly achieve what you want to do in regards to applying different user/user group access rights to certain CMS pages, reports, products, etc. by building your own module(s) to acheive the functionality.

I have achieved a few things with building a custom module to create some user-specific and user group specific functionality by liberally using the t-if and group access rights functionality in one of my custom theme modules that is being built for a client who sells airsoft products here:

http://www.aegguns.com

This website allows for distributor-only features by applying different variations on the following statement:

t-if="not user_id.partner_id.name == 'Public user'"

for example showing an add to cart button for logged in users only you could use the following snippet:
 

<template id="product_add_to_cart_Custom" inherit_id="website_sale.product" name="Add To Quote - Logged In" customize_show="True">

    <xpath expr="//a[@id='add_to_cart']" position="replace">

        <a t-if="not user_id.partner_id.name == 'Public user'" id="add_to_cart" class="btn btn-primary btn-lg mt8 js_check_product a-submit" href="#"><i class="fa fa-angle-double-right"></i>&amp;nbsp;&amp;nbsp;&amp;nbsp;Add to Quotation</a>

    </xpath>

</template>

In regards to group access rights, I believe there are a number of posts in this forum about them. Martin Apitz seems to be quite knowledgeable about this kind of thing. You can see his original answer to my question here regarding setting up distributor-only pricing on the website here:

https://www.odoo.com/forum/help-1/question/how-to-remove-pricing-for-not-logged-in-users-on-e-commerce-website-for-distributor-business-to-business-sales-52924

if you're interested in following the developments on Odoo 9.0 you can take a look at the runbots:

http://runbot.odoo.com/

take a look at the master branch (9.0 under development) and you can login to any of these instances by using username: admin, password: admin. If you'd like to take a look at what is being worked on for Website > Store > Store View type architecture in 9.0 you can take a look under Settings >> Website Settings > localhost (click on the dropdown box and create new). 

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

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

Registrar-se
Related Posts Respostes Vistes Activitat
How to change the layout (or backend theme) for Odoo Online?
layout theme themes
Avatar
Avatar
1
de des. 22
4235
Creating a new Theme Odoo v16 Solved
theme themes odoo16features
Avatar
Avatar
Avatar
2
de maig 23
4322
I can't see web.planner progress bar after installing Backend theme (Odoo10 and 11)
theme themes web.planner
Avatar
0
d’ag. 21
4260
Creating custom theme for Odoo 14 Website Solved
theme website themes
Avatar
Avatar
Avatar
4
d’oct. 20
12359
Themes do not change colors of a website
theme website themes
Avatar
Avatar
1
de juny 20
5465
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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